WeaponSelect.setWeapon C# (CSharp) Method

setWeapon() public method

public setWeapon ( GameObject gameObject ) : void
gameObject GameObject
return void
    public void setWeapon(GameObject gameObject)
    {
        WepEnum wepEnum = (WepEnum)WepEnum.Parse(typeof(WepEnum), gameObject.name);
        weaponState[(int)wepEnum] = true;
    }

Usage Example

Exemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            GameObject g = GameObject.FindGameObjectWithTag("WeaponSelector");
            weaponSelector = g.GetComponent<WeaponSelect>();

            weaponSelector.setWeapon(gameObject);

            Destroy(gameObject);
        }
    }