示例#1
0
文件: _Shoot3.cs 项目: abarabone/a
        // weapon 階層以下に実体を所持する方式 -------------------------
        //  これだと、プレハブが反映されないのが困る

        public void acquireWaponsInChildren(_PlayerShoot3 s)
        {
            weapons = s.GetComponentsInChildren <_Weapon3>();

            foreach (var w in weapons)
            {
                w.acquire(s);
            }
        }
示例#2
0
文件: _Shoot3.cs 项目: abarabone/a
        // weapons 配列にプレハブを指定しておく方式 --------------------
        // これだと、まずるを指定できない…(プレイヤーはそれでもOK)

        public void acquireWaponsInPrefabArrays(_PlayerShoot3 s)
        {
            for (var i = 0; i < weapons.Length; i++)
            {
                var w = (_Weapon3)Instantiate(weapons[i]);

                w.acquire(s);
            }
        }
示例#3
0
    public void unequip(_PlayerShoot3 shoot)
    // 「プレイヤーが」武器チェンジで裏手にまわる時に呼ばれる
    {
        foreach (var unit in units)
        {
            unit.leave(shoot, this);
        }

        mr.enabled = false;
    }
示例#4
0
    // 切り替え --------------------------------------------------------

    public void equip(_PlayerShoot3 shoot)
    // 「プレイヤーが」武器チェンジして手に持った時に呼ばれる
    {
        foreach (var unit in units)
        {
            unit.ready(shoot, this);
        }

        mr.enabled = true;
    }
示例#5
0
    public virtual void acquire(_PlayerShoot3 shoot)
    // 「プレイヤーが」武器を取得した時に呼ばれる
    {
        if (tf == null)
        {
            deepInit();                     //ほんとうはいらないが、プレイヤーの場合 Awake() の中で aquire() を呼んでしまっている…
        }
        tf.parent = shoot.tfHand;

        tf.localPosition = Vector3.zero;

        tf.localRotation = Quaternion.identity;


        tfMuzzle = shoot.tfMuzzle;


        if (mr != null)
        {
            mr.enabled = false;
        }
    }