public IWeapon(WeaponBaseAttr baseAttr, GameObject gameObject)
        {
            mBaseAttr = baseAttr;

            mGameObject = gameObject;

            Transform effect = mGameObject.transform.Find("Effect");

            mParticle     = effect.GetComponent <ParticleSystem>();
            mLineRenderer = effect.GetComponent <LineRenderer>();
            mLight        = effect.GetComponent <Light>();
            mAudioSource  = effect.GetComponent <AudioSource>();
        }
Пример #2
0
        public IWeapon CreateWeapon(WeaponType weaponType)
        {
            IWeapon        weapon   = null;
            WeaponBaseAttr baseAttr = FactoryManager.AttrFactory.GetWeaponBaseAttr(weaponType);
            GameObject     weaponGO = FactoryManager.AssetFactory.LoadWeapon(baseAttr.AssetName);

            switch (weaponType)
            {
            case WeaponType.Gun:
                weapon = new WeaponGun(baseAttr, weaponGO);
                break;

            case WeaponType.Rifle:
                weapon = new WeaponRifle(baseAttr, weaponGO);
                break;

            case WeaponType.Rocket:
                weapon = new WeaponRocket(baseAttr, weaponGO);
                break;
            }

            return(weapon);
        }
 public WeaponRocket(WeaponBaseAttr baseAttr, GameObject gameObject) : base(baseAttr, gameObject)
 {
 }
Пример #4
0
 public WeaponGun(WeaponBaseAttr baseAttr, GameObject gameObject) : base(baseAttr, gameObject)
 {
 }