Beispiel #1
0
 public void Initialize(PowerUpType type, PowerUpPool pool)
 {
     this.type = type;
     this.pool = pool;
     ActivateProperModel(type);
     rotationOffset = new Vector3(Random.value, Random.value, Random.value) * 360f;
     rb.velocity    = Vector3.back * speed;
 }
Beispiel #2
0
 void Awake()
 {
     if (instance != null)
     {
         throw new UnityException("instance not null");
     }
     else
     {
         instance = this;
     }
 }
Beispiel #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         PreparePowerUp();
     }
     else
     {
         Destroy(gameObject);
     }
 }
Beispiel #4
0
    public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans)
    {
        currentSpecialAmmo--;


        //Bullet Spawning
        var mine = PowerUpPool.GetObject();

        mine.SetActive(true);
        mine.transform.position = spawnTrans.transform.position;
        mine.transform.up       = spawnTrans.transform.up;

        var mineProperties = mine.GetComponent <TankMine>();

        mineProperties.score     = score;
        mineProperties.playerNum = playerNum;
    }
Beispiel #5
0
    public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans)
    {
        currentSpecialAmmo--;

        var grenade = PowerUpPool.GetObject();

        grenade.SetActive(true);
        grenade.transform.position = spawnTrans.transform.position;
        grenade.transform.up       = spawnTrans.transform.up;
        Vector2 vel = grenade.transform.up * grenadeSpeed;

        grenade.GetComponent <Rigidbody2D>().velocity = vel;

        TankGrenade grenadeProperties = grenade.GetComponent <TankGrenade>();

        grenadeProperties.startPos  = spawnTrans.position;
        grenadeProperties.playerNum = playerNum;
        grenadeProperties.score     = score;
    }
Beispiel #6
0
    public override void shoot(TankScore score, Statics.Player playerNum, Transform spawnTrans)
    {
        currentSpecialAmmo--;


        //Bullet Spawning
        var bullet = PowerUpPool.GetObject();

        bullet.SetActive(true);
        bullet.transform.position = spawnTrans.transform.position;
        bullet.transform.up       = spawnTrans.transform.up;
        Vector2 vel = bullet.transform.up * bulletSpeed;

        bullet.GetComponent <Rigidbody2D>().velocity = vel;

        //Score and Owner
        TankBullet bulletProperties = bullet.GetComponent <TankBullet>();

        bulletProperties.frontalDamage = frontDamage;
        bulletProperties.normalDamage  = normalDamage;
        bulletProperties.playerNum     = playerNum;
        bulletProperties.score         = score;
    }
Beispiel #7
0
    private void Start()
    {
        SoundsLoader.GetInstance().GetResource("Infected Mushroom - Spitfire [Monstercat Release]");
        _timeCounter = TimePerWave;
        _waveEnemies = new List <GameObject>();
        //Instantiate(pools);
        InitLevelWaves();

        /*
         * for (int i = 0; i < 1; i++)
         * {
         *  GameObject go = Instantiate(prefab);
         *  go.GetComponent<GameEntityController>().SetGameController(this);
         *  go.transform.position = new Vector3(i * 2,i,0);
         * }
         */
        _pool          = GameObject.Find("Pools").GetComponentInChildren <EnemyPool>();
        _itemPool      = GameObject.Find("Pools").GetComponentInChildren <PowerUpPool>();
        _currentLevel  = 0;
        _currentRound  = 0;
        Time.timeScale = 0;
        LoadRound();
    }
Beispiel #8
0
 void Awake()
 {
     pool = GameObject.Find("PowerUpPool").GetComponent <PowerUpPool>();
 }
Beispiel #9
0
 private void Awake()
 {
     current      = this;
     PowerUpArray = Resources.LoadAll <GameObject>("PowerUpPrefabs") as GameObject[];
     CreatePool();
 }