Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        StartingLoc       = transform.localPosition;
        StartSpawnTimer   = SpawnDollsTimer;
        startingFadeValue = fadeAwayValue;
        player            = GameObject.FindGameObjectWithTag("Player");
        playerFound       = false;
        playerStruck      = false;
        hoveredBack       = false;
        readyToHoverBack  = false;
        waitedToHover     = false;

        movingToSpawnDolls      = false;
        SpawnedDolls            = false;
        backFromSpawning        = false;
        OGspotFound             = false;
        pausedBeforeSecondSpawn = false;
        firstDollSpawned        = false;

        currentStrikeCountLeft  = 0;
        currentStrikeCountRight = 0;

        HandsAreIdle          = false;
        sr                    = GetComponent <SpriteRenderer>();
        sr.color              = new Color(1f, 1f, 1f, 0f);
        startLeftStrikeTimer  = LeftStrikeTimer;
        startRightStrikeTimer = RightStrikeTimer; //was divided by 2? idk

        LeftHandToStrike  = true;
        RightHandToStrike = false;

        beginPhaseRelocate = false;
        DollsAreOut        = false;
        waitForRightStrike = false;

        SpawnEdgeDollLocation = transform;
        BossManager           = FindObjectOfType <PuppetBossManager>();

        anim = GetComponent <Animator>();

        if (GameObject.Find("Phase 2 Hand Left(Clone)") != null)
        {
            LeftHand = GameObject.Find("Phase 2 Hand Left(Clone)").GetComponent <Phase2HandsHealthManager>();
        }

        if (GameObject.Find("Phase 2 Hand Right(Clone)") != null)
        {
            RightHand = GameObject.Find("Phase 2 Hand Right(Clone)").GetComponent <P2HandsNew>();
        }
    }
Beispiel #2
0
    void FixedUpdate()
    {
        SORL       = FindObjectOfType <StartOrResetLevel>();
        EHM        = GetComponent <EnemyHealthManager>();
        sr         = GetComponent <SpriteRenderer>();
        HurtPlayer = GetComponent <HurtPlayerOnContact>();
        //Debug.Log(EHM.enemyHealth);
        if (SORL.StartFight)
        {
            phaseOneActivated = true;

            if (phaseOneActivated && !phaseThreeActivated && transform.position.y >= 2.385)
            {
                transform.position = new Vector3(transform.position.x, transform.position.y - 0.04f, transform.position.z);
            }


            if (phaseOneActivated && !phaseTwoActivated)
            {
                if (GameObject.Find("Left Doll") != null || GameObject.Find("Right Doll") != null)
                {
                    LeftDoll  = GameObject.Find("Left Doll").GetComponent <Phase1DollHealthManager>();
                    RightDoll = GameObject.Find("Right Doll").GetComponent <Phase1DollHealthManager>();
                }
                else
                {
                    //Debug.Log("PHASE 1 NOT WORKING PHASE 1 NOT WORKING");
                }
            }
        }

        //Debug.Log(LeftDoll.LeftDollKilled);
        //Debug.Log(RightDoll.RightDollKilled);
        //Debug.Log(GameObject.Find("Left Doll") != null);
        if (LeftDoll.LeftDollKilled && RightDoll.RightDollKilled) //&& (GameObject.Find("Left Doll") != null || GameObject.Find("Right Doll") != null))
        {
            phaseOneActivated = false;
            phaseTwoActivated = true;
            if (phaseTwoActivated && !phaseThreeActivated)
            {
                if (GameObject.Find("Phase 2 Hand Left(Clone)") != null || GameObject.Find("Phase 2 Hand Right(Clone)") != null)
                {
                    LeftHand  = GameObject.Find("Phase 2 Hand Left(Clone)").GetComponent <Phase2HandsHealthManager>();
                    RightHand = GameObject.Find("Phase 2 Hand Right(Clone)").GetComponent <Phase2HandsHealthManager>();
                }
                else
                {
                    //Debug.Log("LOL NOT WORKING");
                }
            }
            //Debug.Log("Phase 1 over. Now entering phase 2...");
        }

        //Debug.Log(LeftHand.LeftHandKilled);
        //Debug.Log(RightHand.RightHandKilled);
        //Debug.Log(phaseThreeActivated);
        if (LeftHand.LeftHandKilled && RightHand.RightHandKilled)
        {
            phaseTwoActivated = false;
            //phaseThreeActivated = true;
            //Debug.Log("Phase 2 over. Now entering phase 3...");
        }
        if (LeftHand.LeftHandKilled && RightHand.RightHandKilled && !P3)
        {
            phaseTwoActivated   = false;
            phaseThreeActivated = true;
            P3 = true;
        }


        if (phaseThreeActivated)
        {
            beginPhaseThreeTimer -= Time.deltaTime;
        }
        if (phaseThreeActivated && !hasMovedForPhase3 && beginPhaseThreeTimer <= 0)
        {
            if (!movedUpPhase3)
            {
                transform.position = new Vector3(transform.position.x, transform.position.y + 0.05f, transform.position.z);
                if (transform.position.y >= 8)
                {
                    movedUpPhase3 = true;
                }
            }
            else if (!movedDownPhase3)
            {
                transform.position = new Vector3(transform.position.x + 0.2f, transform.position.y, transform.position.z);
                if (transform.position.x >= 7.7)
                {
                    movedDownPhase3 = true;
                }
            }
            else
            {
                transform.position = new Vector3(transform.position.x, transform.position.y - 0.08f, transform.position.z);
                if (transform.position.y <= -1.5)
                {
                    hasMovedForPhase3 = true;
                }
            }
        } //end if moving to start phase3

        if (EHM.enemyHealth <= Phase4HP && !phaseFourActivated)
        {
            phaseThreeActivated = false;
            phaseFourActivated  = true;
            //HurtPlayer.enabled = false;
            Destroy(HurtPlayer);
            Debug.Log("Phase 3 over. Now entering phase 4...");
        }

        if (phaseFourActivated)
        {
            beginPhaseFourTimer -= Time.deltaTime;
        }
        if (phaseFourActivated && !hasMovedForPhase4 && beginPhaseFourTimer <= 0)
        {
            if (!movedDownPhase4)
            {
                transform.position = new Vector3(transform.position.x, transform.position.y - 0.05f, transform.position.z);
                if (transform.position.y <= -9)
                {
                    movedDownPhase4 = true;
                    if ((sr = GetComponent <SpriteRenderer>()) != null)
                    {
                        sr.color = new Color(1f, 1f, 1f, sr.color.a - 0.4f);
                    }
                    else
                    {
                        Debug.Log("Puppet Boss Manager SR not working");
                    }
                }
            }
            else if (!movedLeftPhase4)
            {
                transform.position = new Vector3(transform.position.x - 0.15f, transform.position.y, transform.position.z);
                if (transform.position.x <= 0)
                {
                    movedLeftPhase4 = true;
                }
            }
            else
            {
                transform.position = new Vector3(transform.position.x, transform.position.y + 0.06f, transform.position.z);
                if (transform.position.y >= -1.5)
                {
                    hasMovedForPhase4 = true;
                }
            }
        }
    }//end FixedUpdate()