コード例 #1
0
    // ------------------------------------------------------------------
    public void PickNew()
    {
        GameObject pObj = UITool.pthis.CreateUI(ObjHire[ObjHire.Count - 1], "Prefab/S_Weapon");

        pObj.transform.localPosition = new Vector2(0, -73);

        S_Weapon pScript = pObj.GetComponent <S_Weapon>();

        if (pScript)
        {
            pScript.SetLbActive(false);
            pScript.pS_Bg.gameObject.transform.localPosition   = new Vector2(0, 30);
            pScript.pLb_Src.gameObject.transform.localPosition = new Vector2(0, 30);
        }
    }
コード例 #2
0
    public void SetWeaponEquip(S_Weapon weapon)
    {
        weaponEquipped = weapon;

        //set other weapons inactive
        if (otherWeapons != null)
        {
            foreach (object obj in otherWeapons.transform)
            {
                Transform child = (Transform)obj;
                child.gameObject.SetActive(false);
            }
        }
        //set selected weapons active
        switch (weaponEquipped)
        {
        case S_Weapon.DAGGER:
            Weapon            = transform.Find("Weapon/Dagger").gameObject;
            attackStyle       = AttackStyle.Slash;
            attackPlaceHolder = Slash;
            break;

        case S_Weapon.RAPIER:
            Weapon            = transform.Find("Weapon/Rapier").gameObject;
            attackStyle       = AttackStyle.Slash;
            attackPlaceHolder = Slash;
            break;

        case S_Weapon.SPEAR:
            Weapon            = transform.Find("Weapon/Spear").gameObject;
            attackStyle       = AttackStyle.Thrust;
            attackPlaceHolder = Thrust;
            break;

        case S_Weapon.LONGSPEAR:
            Weapon            = transform.Find("Weapon/LongSpear").gameObject;
            attackStyle       = AttackStyle.Thrust;
            attackPlaceHolder = Thrust;
            break;

        case S_Weapon.LONGSWORD:
            Weapon            = transform.Find("Weapon/LongSword").gameObject;
            attackStyle       = AttackStyle.Slash;
            attackPlaceHolder = Slash;
            break;

        case S_Weapon.ARROW:
            Weapon            = transform.Find("Weapon/Arrow").gameObject;
            attackStyle       = AttackStyle.Bow;
            attackPlaceHolder = Slash;
            break;

        case S_Weapon.BOW:
            Weapon            = transform.Find("Weapon/Bow").gameObject;
            attackStyle       = AttackStyle.Bow;
            attackPlaceHolder = Slash;
            break;
        }

        Weapon.SetActive(true);
        WeaponAnim = Weapon.GetComponent <Animator>();
        WeaponAnim.SetBool(attackStyle.ToString(), attackPlaceHolder);
    }