コード例 #1
0
ファイル: Carrot.cs プロジェクト: DashaTyshch/UnityProject
    protected override void onRabbitHit(HeroRabbit rabbit)
    {
        Animator animatorR = rabbit.GetComponent <Animator> ();

        animatorR.SetTrigger("die");
        Destroy(this.gameObject);
    }
コード例 #2
0
ファイル: OrcGreen.cs プロジェクト: vikachuu/UnityProject
    private void OnCollisionEnter2D(Collision2D collision)
    {
        HeroRabbit rabbit = collision.collider.GetComponent <HeroRabbit>();

        if (rabbit != null)
        {
            ContactPoint2D point = collision.contacts[0];
            Debug.Log(point.normal);
            Debug.DrawLine(point.point, point.point + point.normal, Color.red, 10);

            if (Mathf.Abs(point.point.y) >= 0.5f)
            {
                Animator animator = this.GetComponent <Animator>();
                animator.SetTrigger("death");
                die = true;
            }
            else if (!die)
            {
                Animator animatorOrc = GetComponent <Animator>();
                animatorOrc.SetTrigger("attack");

                Animator animator = rabbit.GetComponent <Animator>();
                animator.SetTrigger("death");
                rabbit.isDead = true;
            }
        }
    }
コード例 #3
0
ファイル: Carrot.cs プロジェクト: vikachuu/UnityProject
    protected override void OnRabitHit(HeroRabbit rabbit)
    {
        Animator animator = rabbit.GetComponent <Animator>();

        animator.SetTrigger("death");
        rabbit.isDead = true;

        //this.CollectedHide();

        Destroy(this.gameObject);
    }
コード例 #4
0
 protected override void OnRabitHit(HeroRabbit rabit)
 {
     if (rabit.isBigg())
     {
         rabit.setBig(false);
         Vector3 currSize = rabit.transform.localScale;
         rabit.transform.localScale = new Vector3(currSize.x / 1.5f, currSize.y / 1.5f, 0);
     }
     else
     {
         rabit.GetComponent <Animator>().SetBool("isDie", true);
     }
     this.CollectedHide();
 }
コード例 #5
0
    IEnumerator whileDying(float sec, HeroRabbit rabbit, bool hasMoreLives)
    {
        Animator animator = rabbit.GetComponent <Animator>();

        animator.SetBool("dead", true);
        yield return(new WaitForSeconds(sec));

        rabbit.transform.position = this.startingPosition;
        animator.SetBool("dead", false);
        if (!hasMoreLives)
        {
            rabbit.setInActive();
            LoseLevelPopUp.current.Open();
        }
    }
コード例 #6
0
 protected override void onRabbitHit(HeroRabbit rabbit)
 {
     this.CollectedHide();
     if (rabbit != null)
     {
         if (rabbit.isBigger)
         {
             rabbit.resize(1);
         }
         else
         {
             Animator animator = rabbit.GetComponent <Animator> ();
             animator.SetTrigger("die");
         }
     }
 }
コード例 #7
0
ファイル: Bomb.cs プロジェクト: vikachuu/UnityProject
 protected override void OnRabitHit(HeroRabbit rabbit)
 {
     if (rabbit.hasMushroom)
     {
         rabbit.transform.localScale = new Vector3(1, 1, 1);
         rabbit.hasMushroom          = false;
     }
     else
     {
         // DIE MF DIE (c) Dope
         Animator animator = rabbit.GetComponent <Animator>();
         animator.SetTrigger("death");
         rabbit.isDead = true;
     }
     this.CollectedHide();
 }
コード例 #8
0
 protected virtual void OnRabitHit(HeroRabbit rabit)
 {
     hideAnimation = true;
     if (!rabit.isBigRabbit && rabit != null)
     {
         LevelController.current.onRabitDeath(rabit);
         CollectedHide();
     }
     else if (rabit.isBigRabbit && rabit != null)
     {
         rabit.isBigRabbit = false;
         CollectedHide();
         rabit.canHit = false;
         rabit.GetComponent <SpriteRenderer>().sprite = Resources.Load("pain_000", typeof(Sprite)) as Sprite;
     }
 }
コード例 #9
0
    IEnumerator dsbl(HeroRabbit rabit)
    {
        yield return(new WaitForSeconds(0.2f));

        rabit.GetComponent <HeroRabbit>().enabled = false;
    }