Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (CurrentStatus == BirdStatus.BirdStatus_Normal)
        {
            Vector3 move = Vector3.left * SpeedX * Time.deltaTime;
            this.transform.Translate(move);
        }
        else if (CurrentStatus == BirdStatus.BirdStatus_Freeze)
        {
            CurrentFreezeTime += Time.deltaTime;
            SwordAutoController sac = GameObject.FindObjectOfType <SwordAutoController>();
            if (CurrentFreezeTime >= sac.TotalFreezeTime)
            {
                CurrentStatus     = BirdStatus.BirdStatus_Normal;
                CurrentFreezeTime = 0;
            }
        }
        else if (CurrentStatus == BirdStatus.BirdStatus_ToHotPot)
        {
            float GritySpeed = -10f * (FlyHotPotTime);

            //SpeedY -= 10  * Time.deltaTime;
            Vector3 move = (SpeedY + GritySpeed) * Time.deltaTime * Vector3.up;
            this.transform.position += move;

            FlyHotPotTime += Time.deltaTime;
        }
    }
Ejemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.layer == LayerMask.NameToLayer("Sword"))
     {
         Debug.Log("GameOver");
         SwordAutoController sac = GameObject.FindObjectOfType <SwordAutoController>();
         if (sac)
         {
             sac.CurrentStatus = SwordStatus.SwordStatus_GameOver;
         }
     }
 }
Ejemplo n.º 3
0
    virtual public void FlyToHotPot()
    {
        SpeedY        = FlyHotPotSpeedY;
        FlyHotPotTime = 0;

        CurrentStatus = BirdStatus.BirdStatus_ToHotPot;

        SwordAutoController sac = GameObject.FindObjectOfType <SwordAutoController>();

        if (sac)
        {
            sac.Freeze();
            BirdBase[] birds = GameObject.FindObjectsOfType <BirdBase>();
            foreach (var bird in birds)
            {
                if (bird && bird != this)
                {
                    bird.Freeze();
                }
            }
        }
        Die();
    }
Ejemplo n.º 4
0
    virtual public void Move()
    {
        if (CurrentStatus == BirdStatus.BirdStatus_Normal)
        {
            Vector3 move = Vector3.left * SpeedX * Time.deltaTime;
            this.transform.Translate(move);
        }
        else if (CurrentStatus == BirdStatus.BirdStatus_Freeze)
        {
            CurrentFreezeTime += Time.deltaTime;
            SwordAutoController sac = GameObject.FindObjectOfType <SwordAutoController>();
            if (CurrentFreezeTime >= sac.TotalFreezeTime)
            {
                CurrentStatus     = BirdStatus.BirdStatus_Normal;
                CurrentFreezeTime = 0;
            }
        }
        else if (CurrentStatus == BirdStatus.BirdStatus_ToHotPot)
        {
            float GritySpeed = -FlyHotPotAcc * (FlyHotPotTime);

            //SpeedY -= 10  * Time.deltaTime;
            Vector3 move = (SpeedY + GritySpeed) * Time.deltaTime * Vector3.up;
            this.transform.position += move;

            FlyHotPotTime += Time.deltaTime;
        }
        else if (CurrentStatus == BirdStatus.BirdStatus_FlyAway)
        {
            this.transform.Rotate(Vector3.forward, FlyAwayAngleSpeed);

            Vector3 move = Vector3.right * SpeedX * 3 * Time.deltaTime
                           + Vector3.down * SpeedY * Time.deltaTime;
            this.transform.position += move;
            //flyAwayAngle += FlyAwayAngleSpeed * Time.deltaTime;
        }
    }