Ejemplo n.º 1
0
    private void SpawnEnemy(EnemyScript.EnemyManeuver type)
    {
        EnemyScript.EnemyManeuver _type = type;
        GameObject spawnPrefab;

        int value = UnityEngine.Random.Range(0, spawned);

        //Debug.Log (new Vector3(value).ToString ());
        if (value - friendAmount < 0)
        {
            spawnPrefab = Friend;
            friendAmount--;
            //Debug.Log (friendAmount);
        }
        else if (value - friendAmount - armoredAmount < 0)
        {
            spawnPrefab = Armored;
            armoredAmount--;
        }
        else if (value - friendAmount - armoredAmount - armedAmount < 0)
        {
            spawnPrefab = Armed;
            armedAmount--;
            _type = EnemyScript.EnemyManeuver.Static;
        }
        else
        {
            spawnPrefab = Enemy;
        }

        timeToSpawn = SpawnTime;
        GameObject _enemy = Instantiate(spawnPrefab, new Vector3(UnityEngine.Random.Range(-SpawnEnemyBorder, SpawnEnemyBorder), 0, SpawnHeight), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject;

        _enemy.GetComponent <EnemyScript> ().setType(_type);
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     speed               *= LevelManagerScript.currentLevel.gunSpeedModifier;
     bulletSpeed         *= LevelManagerScript.currentLevel.bulletSpeedModifier;
     artilleryBulletSpeed = 0.0f;
     fireRate            *= LevelManagerScript.currentLevel.gunReloadModifier;
     health               = fullHealth;
     healthBar.GetComponent <ProgressBar.ProgressRadialBehaviour> ().SetFillerSize(health / fullHealth);
     nextFire  = 0;
     enemyType = LevelManagerScript.currentLevel.enemyType;
 }
Ejemplo n.º 3
0
    /*void OnCollisionEnter(Collision other){
     *      if (other.gameObject.tag == "wall"){
     *              Debug.Log ("wall-in");
     *      }
     * }*/

    void Start()
    {
        SoundManager.instance.PlayEffect(shotEffect);
        enemyType        = LevelManagerScript.currentLevel.enemyType;
        isArtilleryModOn = LevelManagerScript.currentLevel.isArtilleryModeOn;
        if (isArtilleryModOn)
        {
            bulletTrace    = GetComponent <TrailRenderer> ();
            bulletBody     = GetComponent <Rigidbody> ();
            maxTraceLength = bulletTrace.time * 1.5f;
        }
    }
Ejemplo n.º 4
0
        public Level(Level other)
        {
            number = other.number;
            stars  = other.stars;
            locked = other.locked;

            gunSpeedModifier    = other.gunSpeedModifier;
            gunReloadModifier   = other.gunReloadModifier;
            bulletSpeedModifier = other.bulletSpeedModifier;

            enemySpeed = other.enemySpeed;
            enemySize  = other.enemySize;
            enemyType  = other.enemyType;
            spawnRate  = other.spawnRate;

            friendSpawnChance  = other.friendSpawnChance;
            armoredSpawnChance = other.armoredSpawnChance;
            armedSpawnChance   = other.armedSpawnChance;

            onButtonClicked = other.onButtonClicked;
        }