示例#1
0
    public static void SetAttackinMotion()
    {
        MainEnemyFormation mainEnemyForm = GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>();

        if (mainEnemyForm && GalagaHelper.EnemiesKilled < 41)
        {
            int x = GalagaHelper.RandomNumber(0, 7);
            if (x == 1)
            {
                mainEnemyForm.enemy1Picked = true;
            }
            else if (x == 2)
            {
                mainEnemyForm.enemy2Picked = true;
            }
            else if (x == 3)
            {
                mainEnemyForm.enemy3Picked = true;
            }
            else if (x == 4)
            {
                PrintAllGhostObjects();
            }
            else if (x == 5)
            {
                mainEnemyForm.enemy1Picked = true;
            }
            else
            {
                mainEnemyForm.enemy1Picked = true;
            }
            //Debug.Log("Ran random attacks: ".Colored(Colors.green) + x.ToString().Bold());
        }
    }
示例#2
0
    void Update()
    {
        // Get the number of enemies in place on the current Formation
        //enemiesInPlace = isEnemyInPlace();
        //+ " - enemies in place: " + enemiesInPlace.ToString().Colored(Colors.red

        if (gameObject.name == "Round1Phase1EnemyFormation")
        {
            Debug.Log(gameObject.name.Bold() + " Just Spawned: " + GalagaHelper.JustSpawned + " Enemies Spawned: " + GalagaHelper.EnemiesSpawned + " Enemies Killed: " + GalagaHelper.EnemiesKilled + " Enemies Disabled: " + GalagaHelper.DisabledEnemies + " PlayerLifes: " + GalagaHelper.numOfPlayers);
            // Check if 8 enemies have spawned then run them
            GalagaHelper.StartRound1();
            if (GalagaHelper.EnemiesKilled >= GalagaHelper.JustSpawned && GalagaHelper.JustSpawned != 0)
            {
                Debug.Log("Round2 started".Bold().Sized(11));
                // Reset Variables
                GalagaHelper.ResetFormations();
                GalagaHelper.CurrentRoundPhase = GalagaHelper.Formations.Round1Phase1;
                GalagaHelper.RoundNumber      += 1;
                MainEnemyFormation main = GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>();
                main.RestartRound();
                GalagaHelper.EnemiesKilled    = 0;
                GalagaHelper.JustSpawned      = 0;
                GalagaHelper.EnemiesSpawned   = 0;
                GalagaHelper.DisabledEnemies  = 0;
                GalagaHelper.isWaveOneStarted = false;
                SpawnUntilFull();
            }
        }
    }
示例#3
0
 public void ResumeGame()
 {
     if (starfield.isPaused == true && GalagaHelper.isPlayerCaptured == true)
     {
         MainEnemyFormation main = GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>();
         main.isPlayerReady = true;
         isPlayerLive       = true;
         Debug.Log("ISpLAYERrEADY IS TRUE");
     }
 }
示例#4
0
    void OnTriggerEnter(Collider other)
    {
        Projectile enemyProjectile = other.gameObject.GetComponent <Projectile>();

        //Enemy1Controller enemy1 = other.gameObject.GetComponent<Enemy1Controller>();
        if (other.gameObject.layer == 10 || enemyProjectile)
        {
            if (isPlayerLive)
            {
                Debug.Log("GameObject " + other.gameObject.name + " hit player.");
                GameObject explosionPrefab = Instantiate(explosion, gameObject.transform.position, gameObject.transform.rotation) as GameObject;
                Destroy(explosionPrefab, 3.0f);
                top    = addShotSounds(explosionTop, Random.Range(0.8f, 1.2f));
                bottom = addShotSounds(explosionBottom, Random.Range(0.8f, 1.2f));
                top.Play();
                bottom.Play();
                rend.enabled = false;
                isPlayerLive = false;
                if (enemyProjectile)
                {
                    enemyProjectile.Hit();
                    Debug.Log("Enemy proj hit Player.");
                }
                else
                {
                    SimplePool.Despawn(other.gameObject);
                    Debug.Log("Enemy ran into Player".Colored(Colors.blue));
                }
                //SimplePool.Despawn(this.gameObject);
                GalagaHelper.numOfPlayers -= 1;
                GalagaHelper.PlacePlayerIcons();
                GalagaHelper.isPlayerCaptured = true;
                GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>().isReadyDone = false;
                Destroy(gameObject);
                if (!CanPlayerStillPlay())
                {
                    MainEnemyFormation main = GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>();
                    main.Invoke("EndGame", 3.0f);
                }
                else
                {
                    CreatePlayer();
                }
            }
        }

        //if (enemyProjectile)
        //{
        //    if (isPlayerLive)
        //    {
        //        GameObject explosionPrefab = Instantiate(explosion, gameObject.transform.position, gameObject.transform.rotation) as GameObject;
        //        Destroy(explosionPrefab, 3.0f);
        //        Debug.Log("Enemy proj hit Player.");
        //        top = addShotSounds(explosionTop, Random.Range(0.8f, 1.2f));
        //        bottom = addShotSounds(explosionBottom, Random.Range(0.8f, 1.2f));
        //        top.Play();
        //        bottom.Play();
        //        enemyProjectile.Hit();
        //        rend.enabled = false;
        //        isPlayerLive = false;
        //        //SimplePool.Despawn(gameObject);
        //        GalagaHelper.numOfPlayers -= 1;
        //        GalagaHelper.PlacePlayerIcons();
        //        GalagaHelper.isPlayerCaptured = true;
        //        GameObject.FindGameObjectWithTag("MainFormation").GetComponent<MainEnemyFormation>().isReadyDone = false;
        //        Destroy(gameObject);
        //        if (!CanPlayerStillPlay())
        //        {
        //            MainEnemyFormation main = GameObject.FindGameObjectWithTag("MainFormation").GetComponent<MainEnemyFormation>();
        //            main.Invoke("EndGame", 3.0f);
        //            //Invoke("EndGame", 3.0f);
        //        }
        //        else
        //        {
        //            CreatePlayer();
        //        }
        //    }
        //}

        Debug.Log("Something hit the player.".Colored(Colors.darkblue));
    }
示例#5
0
    public void Start()
    {
        hero = GameObject.FindGameObjectWithTag("Player");
        rend = GetComponent<Renderer>();
        meshcol = GetComponent<MeshCollider>();
        main = GameObject.FindGameObjectWithTag("MainFormation").GetComponent<MainEnemyFormation>();
        spawnDisableTime = 10.0f;
        // get end direction random
        GalagaHelper.SetEnemy2Random();
        GalagaHelper.Enemy2PathEnd = GalagaHelper.Enemy2PathDirection();
        // get Tranform.Lookat() for Enemy2
        GalagaHelper.Enemy2LookAt();
        //Debug.Log("Enemy2Random: ".Colored(Colors.red) + GalagaHelper.Enemy2Random);
        round1Phase1spawner = GameObject.Find("Round1Phase1EnemyFormation").GetComponent<EnemySpawner>();
        scoreKeeper = GameObject.Find("Score").GetComponent<ScoreKeeper>();
        isEnemyFiring = false;
        //Debug.Log("enemies spawned: " + GalagaHelper.EnemiesSpawned);

        // Wave 1 path creation.
        if (GalagaHelper.JustSpawned <= 8)
        {
            // Spawn 1 of 5 phases
            if (round1Phase1spawner.spawnEntranceRight)
            {
                myTween.Add("path", GalagaHelper.EntrancePatterns(GalagaHelper.EntranceFlightPatterns.round1_DownRight));
                myTween.Add("delay", GalagaHelper.Wave1Delay);
                GalagaHelper.Wave1Delay += fDelay;
                //Debug.Log("1 WAVE DELAY; " + GalagaHelper.Wave1Delay);
            }
            else
            {
                myTween.Add("path", GalagaHelper.EntrancePatterns(GalagaHelper.EntranceFlightPatterns.round1_DownLeft));
                myTween.Add("delay", GalagaHelper.Wave1Delay);
                GalagaHelper.Wave1Delay += fDelay;
                //Debug.Log("1 WAVE DELAY; " + GalagaHelper.Wave1Delay);
            }
        }

        // Collect all 1st wave enemies and move them all at once with a delay
        if (GalagaHelper.JustSpawned < 9)
        {
            myTween.Add("time", movePathTime);
            myTween.Add("easetype", "linear");
            myTween.Add("onComplete", "EnemyCompletePath");
            myTween.Add("onCompleteTarget", gameObject);
            GalagaHelper.CollectEnemyPaths(gameObject, myTween);
            //GalagaHelper.CurrentRoundPhase += 1;
        }

        if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase2 && GalagaHelper.JustSpawned <= 16)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase2, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase3 && GalagaHelper.JustSpawned <= 24)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase3, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase4 && GalagaHelper.JustSpawned <= 32)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase4, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase5 && GalagaHelper.JustSpawned <= 40)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase5, GalagaHelper.RoundNumber);
            spawnDisableTime = 2.0f;
        }
    }
示例#6
0
    public void Start()
    {
        hero             = GameObject.FindGameObjectWithTag("Player");
        rend             = GetComponent <Renderer>();
        meshcol          = GetComponent <MeshCollider>();
        main             = GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>();
        spawnDisableTime = 10.0f;
        // get end direction random
        GalagaHelper.SetEnemy2Random();
        GalagaHelper.Enemy2PathEnd = GalagaHelper.Enemy2PathDirection();
        // get Tranform.Lookat() for Enemy2
        GalagaHelper.Enemy2LookAt();
        //Debug.Log("Enemy2Random: ".Colored(Colors.red) + GalagaHelper.Enemy2Random);
        round1Phase1spawner = GameObject.Find("Round1Phase1EnemyFormation").GetComponent <EnemySpawner>();
        scoreKeeper         = GameObject.Find("Score").GetComponent <ScoreKeeper>();
        isEnemyFiring       = false;
        //Debug.Log("enemies spawned: " + GalagaHelper.EnemiesSpawned);

        // Wave 1 path creation.
        if (GalagaHelper.JustSpawned <= 8)
        {
            // Spawn 1 of 5 phases
            if (round1Phase1spawner.spawnEntranceRight)
            {
                myTween.Add("path", GalagaHelper.EntrancePatterns(GalagaHelper.EntranceFlightPatterns.round1_DownRight));
                myTween.Add("delay", GalagaHelper.Wave1Delay);
                GalagaHelper.Wave1Delay += fDelay;
                //Debug.Log("1 WAVE DELAY; " + GalagaHelper.Wave1Delay);
            }
            else
            {
                myTween.Add("path", GalagaHelper.EntrancePatterns(GalagaHelper.EntranceFlightPatterns.round1_DownLeft));
                myTween.Add("delay", GalagaHelper.Wave1Delay);
                GalagaHelper.Wave1Delay += fDelay;
                //Debug.Log("1 WAVE DELAY; " + GalagaHelper.Wave1Delay);
            }
        }

        // Collect all 1st wave enemies and move them all at once with a delay
        if (GalagaHelper.JustSpawned < 9)
        {
            myTween.Add("time", movePathTime);
            myTween.Add("easetype", "linear");
            myTween.Add("onComplete", "EnemyCompletePath");
            myTween.Add("onCompleteTarget", gameObject);
            GalagaHelper.CollectEnemyPaths(gameObject, myTween);
            //GalagaHelper.CurrentRoundPhase += 1;
        }

        if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase2 && GalagaHelper.JustSpawned <= 16)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase2, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase3 && GalagaHelper.JustSpawned <= 24)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase3, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase4 && GalagaHelper.JustSpawned <= 32)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase4, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase5 && GalagaHelper.JustSpawned <= 40)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase5, GalagaHelper.RoundNumber);
            spawnDisableTime = 2.0f;
        }
    }