예제 #1
0
    public void hit()
    {
        tk2dSpriteAnimator ani = gameObject.GetComponent <tk2dSpriteAnimator>();

        energy--;
        if (energy == 1)
        {
            ani.Play("hit");
            EMoveEngin moveEngin = gameObject.GetComponent <EMoveEngin>();
            moveEngin.isMoving(false);
        }
        else if (energy == 0)
        {
            ani.Play("die");
            EMoveEngin moveEngin = gameObject.GetComponent <EMoveEngin>();
            moveEngin.isMoving(false);
            energy = firstEnergy;
            GetComponent <EnermyDieMotion>().isDie();
        }
    }
예제 #2
0
    void playerDie(GameObject hitObj)
    {
        BoxCollider         box        = GetComponent <BoxCollider>();
        CharacterController controller = GetComponent <CharacterController>();

        if (isSuper)
        {
            if (null != box)
            {
                box.enabled = false;
            }
            controller.collider.isTrigger = true;
            superMode    = true;
            isSuper      = false;
            isFire       = false;
            chcon.height = 1.04F;
            StartCoroutine("unSuper", 2f);
        }
        else
        {
            EMoveEngin mov = hitObj.GetComponent <EMoveEngin>();
            mov.isMoving(false);
            chcon.collider.enabled = false;
            isDie          = true;
            isRiversBounce = true;
            tk2dSpriteAnimator ani = GetComponent <tk2dSpriteAnimator>();
            ani.Play("die");
            controller.collider.isTrigger = true;
            StartCoroutine("playerDown", .5f);

            if (null != box)
            {
                box.enabled = false;
            }
        }
    }