Пример #1
0
        static void Main(string[] args)
        {
            Enemy bigEnemy   = new BigEnemy(new BigGun());
            Enemy smallEnemy = new SmallEnemy(new SmallGun());

            bigEnemy.Attack();
            smallEnemy.Attack();
        }
Пример #2
0
 public void init(SmallEnemy owner)
 {
     name = "SmallEnemyModel";
     this.owner = owner;
     transform.parent = owner.transform;
     transform.localPosition = new Vector3(0,0,0);
     transform.localScale = new Vector3 (.85f, 1f, 1f);
     name = "Asteroid Model";
     mat = GetComponent<Renderer>().material;
     mat.shader = Shader.Find ("Sprites/Default");	// Tell the renderer that our textures have transparency. // Get the material component of this quad object.
     mat.mainTexture = Resources.Load<Texture2D>("Textures/SmallShip");	// Set the texture.  Must be in Resources folder.
     mat.color = new Color(1,1,1);											// Set the color (easy way to tint things).
 }
Пример #3
0
    IEnumerator SmallEnemySpawnWave(int amount, bool goLeft)
    {
        Transform spawnPoint = goLeft ? spawnPoints[spawnPoints.Length - 1] : spawnPoints[0];

        for (int i = 0; i < amount; i++)
        {
            GameObject enemyObject = Instantiate(enemyTypes[0], spawnPoint.position, Quaternion.identity);
            SmallEnemy enemy       = enemyObject.GetComponent <SmallEnemy>();
            enemy.SetSwayDirection(goLeft);
            enemiesAlive.Add(enemy);
            yield return(new WaitForSeconds(timeBetweenSpawns));
        }
        SignalCompletionOfWave();
    }