Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        playerMovementScript = GameObject.Find("Player").GetComponent <PlayerMovement>();

        if (SceneManager.GetActiveScene().name == PHASE1)
        {
            cols = GameObject.Find("Cols");
        }
        else if (SceneManager.GetActiveScene().name == PHASE2_3)
        {
            inhaleScript = GameObject.Find("WaterBoss").transform.GetChild(5).GetComponent <inhale>();
            GameObject.Find("WaterBoss").transform.GetChild(5).gameObject.SetActive(false);
            waterBossAiScript = GameObject.Find("WaterBoss").GetComponent <WaterBossAI>();

            //RandomIndex for toCorner WaterBossState
            for (int i = 0; i < randomAmount; i++)
            {
                do
                {
                    numberInsert = Random.Range(0, waterBossAiScript.corners.Count);
                } while (numberInsert == temp);

                temp = numberInsert;
                randomIndex.Add(numberInsert);
            }
        }
    }
 private void Start()
 {
     playerMovementScript = GameObject.Find("Player").GetComponent <PlayerMovement>();
     waterBossScript      = GameObject.Find("WaterBoss").GetComponent <WaterBossAI>();
     col         = GetComponent <Collider2D>();
     visual      = transform.GetChild(0).gameObject;
     turbineIsOn = false;
     col.enabled = !col.enabled;
     visual.SetActive(false);
     randomTime = Random.Range(Min, Max);
 }
    void Start()
    {
        tempPlayerSpeed         = GameObject.Find("Player").GetComponent <PlayerMovement>().moveSpeed;
        playerMovementScript    = GameObject.Find("Player").GetComponent <PlayerMovement>();
        waterBossAIScript       = GameObject.Find("WaterBoss").GetComponent <WaterBossAI>();
        waterStagemanagerScript = GameObject.Find("WaterStageManager").GetComponent <WaterStageManager>();
        spriteRenderer          = GetComponent <SpriteRenderer>();
        col           = GetComponent <Collider2D>();
        explosion     = transform.GetChild(1).gameObject;
        propellerAnim = transform.GetChild(0).GetComponent <Animator>();
        explosionAnim = transform.Find("UnderwaterExplosion").GetComponent <Animator>();

        explosion.SetActive(false);
        repeateTime = Random.Range(repeateTimeMin, repeateTimeMax);
        //destroy();
    }
Beispiel #4
0
    void Start()
    {
        waterStageManagerScript = GameObject.Find("WaterStageManager").GetComponent <WaterStageManager>();
        if (eel)
        {
            animator = GetComponent <Animator>();
            // eelElecCollider = this.gameObject.transform.root.GetChild(1).GetComponent<Collider2D>();
        }

        body_Anim = transform.root.GetChild(1).GetComponent <Animator>();
        Parent    = transform.parent.gameObject;
        visual    = transform.parent.GetChild(1).gameObject;
        col       = GetComponent <Collider2D>();

        //if phase is NOT phase1
        if (SceneManager.GetActiveScene().name != waterStageManagerScript.PHASE1)
        {
            waterBossScript = GameObject.Find("WaterBoss").GetComponent <WaterBossAI>();
            canDo           = true;
        }

        //StartCoroutine(CalcVelocity());
    }
Beispiel #5
0
    private void FixedUpdate()
    {
        if (timerText == null)
        {
            if (SceneManager.GetActiveScene().name != WorldSceneManager.INTERACTIVEMENU && SceneManager.GetActiveScene().name != WorldSceneManager.MAINMENU &&
                SceneManager.GetActiveScene().name != WorldSceneManager.SUBMITSCORESCENE && SceneManager.GetActiveScene().name != WorldSceneManager.BREAKROOM)
            {
                print(SceneManager.GetActiveScene().name);
                timerText = GameObject.FindGameObjectWithTag("TimerText").GetComponent <Text>();
            }
        }

        if (SceneManager.GetActiveScene().name == "Main")
        {
            if (firstBoss == null && GameObject.Find("Boss").GetComponent <BossScript>() != null)
            {
                print("first boss script fetched");
                firstBoss = GameObject.Find("Boss").GetComponent <BossScript>();
            }

            if (firstBoss != null)
            {
                if (firstBoss.currentStage2HP > 0)
                {
                    print(boss1Time);
                    boss1Time     += Time.deltaTime;
                    timerText.text = Mathf.RoundToInt((int)boss1Time).ToString();
                }

                if (firstBoss.pMoveScript.currentHealth <= 0 && thirdBoss.thirdPhaseHP > 0)
                {
                    boss1Time = 0;
                }
            }
        }


        //2nd boss time management

        //WaterStageManager search
        if (SceneManager.GetActiveScene().name == "Stage2Phase1")
        {
            if (waterStageManager == null)
            {
                waterStageManager = GameObject.FindGameObjectWithTag("WaterStageManager").GetComponent <WaterStageManager>();
            }

            if (waterStageManager.LeversActivated < 3)
            {
                boss2Time     += Time.deltaTime;
                timerText.text = Mathf.RoundToInt((int)boss2Time).ToString();
            }
        }

        if (SceneManager.GetActiveScene().name == "Stage2Phase2")
        {
            if (secondInhale == null)
            {
                secondInhale = GameObject.FindGameObjectWithTag("Boss").GetComponent <WaterBossAI>();
            }

            if (secondInhale != null)
            {
                if (secondInhale.inhaleScript.inhaledEnemies < 20)
                {
                    boss2Time     += Time.deltaTime;
                    timerText.text = Mathf.RoundToInt((int)boss2Time).ToString();
                }
            }
        }



        //third boss time management
        if (SceneManager.GetActiveScene().name == "ThirdBoss")
        {
            if (thirdBoss == null)
            {
                thirdBoss = GameObject.FindGameObjectWithTag("Boss").GetComponent <ThirdBossSM>();
                print(thirdBoss);
            }

            if (thirdBoss != null)
            {
                if (thirdBoss.thirdPhaseHP > 0)
                {
                    //print(boss3Time);
                    boss3Time     += Time.deltaTime;
                    timerText.text = Mathf.RoundToInt((int)boss3Time).ToString();
                }

                if (thirdBoss.playerDead == true && thirdBoss.thirdPhaseHP > 0)
                {
                    boss3Time = 0;
                }
            }
        }

        //////////////////////////////////////////////
    }
 public WaterWaiting(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI = waterBossAI;
 }
 public WaterDeath(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI = waterBossAI;
 }
 public WaterToCorner(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI = waterBossAI;
 }
 public WaterInHale(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI = waterBossAI;
 }
 public WaterWhirlpool(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI = waterBossAI;
 }
 public WaterBreath(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI        = waterBossAI;
     waterBossAI.rb.velocity = Vector2.zero;
 }
 public WaterTurbine(string stateID, WaterBossAI waterBossAI) : base(stateID)
 {
     this.waterBossAI = waterBossAI;
 }