Esempio n. 1
0
 public void OnTriggerEnter(Collider coll)
 {
     if (coll.transform.name == "JumpPoint" && bossState == bossArcherIA.MOVING && bossState != bossArcherIA.DEAD)
     {
         currentStartJumpPoint = transform.position;
         timeJumping = 0.0f;
         SoundManager.instance.PlaySingle(jumpSound);
         int random;
         random = Random.Range(1, 3);
         if (bossPos == bossArcherPos.MAXRIGHT)
         {
             if (random == 1)
             {
                 bossPos = bossArcherPos.MEDIUMRIGHT;
                 currentEndJumpPoint = EndJumpPoint[4].position + new Vector3(-1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[4].position;
             }
             else
             {
                 bossPos = bossArcherPos.MEDIUMLEFT;
                 currentEndJumpPoint = EndJumpPoint[2].position + new Vector3(-1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[3].position;
             }
         }
         else if (bossPos == bossArcherPos.MAXLEFT)
         {
             if (random == 1)
             {
                 bossPos = bossArcherPos.MEDIUMLEFT;
                 currentEndJumpPoint = EndJumpPoint[1].position + new Vector3(+1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[0].position;
             }
             else
             {
                 bossPos = bossArcherPos.MEDIUMRIGHT;
                 currentEndJumpPoint = EndJumpPoint[3].position + new Vector3(1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[1].position;
             }
         }
         else if (bossPos == bossArcherPos.MEDIUMLEFT && movingRight)
         {
             if (random == 1)
             {
                 bossPos = bossArcherPos.MEDIUMRIGHT;
                 currentEndJumpPoint = EndJumpPoint[3].position + new Vector3(1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[2].position;
             }
             else
             {
                 bossPos = bossArcherPos.MAXRIGHT;
                 currentEndJumpPoint = EndJumpPoint[5].position + new Vector3(1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[3].position;
             }
         }
         else if (bossPos == bossArcherPos.MEDIUMLEFT && !movingRight)
         {
             bossPos = bossArcherPos.MAXLEFT;
             currentEndJumpPoint = EndJumpPoint[0].position + new Vector3(-1f, -1f, 0f);
             currentMiddleJumpPoint = MiddleJumpPoint[0].position;
         }
         else if (bossPos == bossArcherPos.MEDIUMRIGHT && movingRight)
         {
             bossPos = bossArcherPos.MAXRIGHT;
             currentEndJumpPoint = EndJumpPoint[5].position + new Vector3(1f, -1f, 0f);
             currentMiddleJumpPoint = MiddleJumpPoint[4].position;
         }
         else if (bossPos == bossArcherPos.MEDIUMRIGHT && !movingRight)
         {
             if (random == 1)
             {
                 bossPos = bossArcherPos.MEDIUMLEFT;
                 currentEndJumpPoint = EndJumpPoint[2].position + new Vector3(-1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[2].position;
             }
             else
             {
                 bossPos = bossArcherPos.MAXLEFT;
                 currentEndJumpPoint = EndJumpPoint[0].position + new Vector3(-1f, -1f, 0f);
                 currentMiddleJumpPoint = MiddleJumpPoint[1].position;
             }
         }
         else
         {
             Debug.Log("HEHE; ERROR");
         }
         bossState = bossArcherIA.JUMPING;
         fallingJump = false;
         animator.SetTrigger("Jump");
     }
     else if (coll.transform.name == "StopPoint" && firstStopPoint && bossState != bossArcherIA.DEAD && !shootInThisPlatform)
     {
         firstStopPoint = false;
     }
     else if (coll.transform.name == "StopPoint" && !firstStopPoint && bossState != bossArcherIA.DEAD && !shootInThisPlatform)
     {
         if (bossPos == bossArcherPos.MEDIUMLEFT || bossPos == bossArcherPos.MEDIUMRIGHT)
             transform.position = new Vector3(transform.position.x, transform.position.y, 17.5f - 5.34f);
         if (movingRight)
         {
             bossState = bossArcherIA.TURNING_RIGHT_TO_STOP;
             animator.speed = currentSpecialSpeed;
             animator.SetTrigger("TurnRight");
         }
         else
         {
             bossState = bossArcherIA.TURNING_LEFT_TO_STOP;
             animator.speed = currentSpecialSpeed;
             animator.SetTrigger("TurnLeft");
         }
         animator.SetBool("Run", false);
     }
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {

        rigidbody = transform.GetComponent<Rigidbody>();
        boxCollider = transform.GetComponent<BoxCollider>();
        timeSinceStateChanged = 0.0f;
        bossPos = bossArcherPos.MEDIUMRIGHT;
        bossState = bossArcherIA.IDLE;
        timeSinceStateChanged = 0.0f;
        timeJumping = 0.0f;

        arrows = new Transform[arrowPool.childCount];
        for (int i = 0; i < arrowPool.childCount; ++i)
        {
            arrows[i] = arrowPool.GetChild(i);
        }
        arrowsScript = new BossArrowScript[arrowPool.childCount];
        for (int i = 0; i < arrows.Length; ++i)
        {
            arrowsScript[i] = arrows[i].GetComponent<BossArrowScript>();
        }
        animator = transform.GetComponent<Animator>();
        firstStopPoint = true;
        slowFPS.SlowFPSChangedStatusEvent += SlowFPSStateChanged;
        timeWhenLastHitted = Time.time;

        playerScript.PlayerDeadEvent += GlitchDead;
        playerScript.PlayerReviveEvent += GlitchRevives;

        upArrow.gameObject.SetActive(false);

        heart1 = HUDLives.FindChild("Heart1").GetComponent<Image>();
        heart2 = HUDLives.FindChild("Heart2").GetComponent<Image>();
        heart3 = HUDLives.FindChild("Heart3").GetComponent<Image>();
        heart4 = HUDLives.FindChild("Heart4").GetComponent<Image>();
        heart5 = HUDLives.FindChild("Heart5").GetComponent<Image>();

        //transform.FindChild("GlitchCollider").GetComponent<GlitchArcher>().BossGlitchedEvent += GlitchArcher;

        endBoss.BossGlitchEvent += GlitchArcher;
    }