Esempio n. 1
0
 public override void UpdateAction()
 {
     base.UpdateAction();
     if (stateMachine.timeSinceLastChange < startupTime)
     {
         hitBox.GetComponent <Collider2D>().offset = 0.5f * (move.facing.normalized);
     }
     else if (stateMachine.timeSinceLastChange < startupTime + activeTime)
     {
         //hitbox stuff
         print("IM PUNCHING HERE!");
         if (hitBox != null)
         {
             hitBox.hitting = true;
             Debug.Log("did it again");
         }
     }
     else if (stateMachine.timeSinceLastChange < startupTime + activeTime + recoveryTime)
     {
         hitBox.hitting = false;
     }
     else
     {
         if (this.GetComponent <Animator> ())
         {
             this.GetComponent <Animator> ().Play("IdleState");
         }
         stateMachine.SetNotTrue(Terms.punchingVar);
     }
 }
Esempio n. 2
0
    public virtual HitBox AddHitBox()
    {
        HitBox Temp = ObjectManager.Instance.AddObject("HitBox", m_HitBox.transform.position).GetComponent <HitBox>();

        Temp.GetComponent <BoxCollider2D>().size = m_HitBox.GetComponent <BoxCollider2D>().size;
        Temp.Set(m_HitBox.m_Damage, m_HitBox.m_Force, m_HitBox.m_HitTime, m_HitBox.m_Shake, m_HitBox.m_StopTime);
        Temp.m_Owner = gameObject;
        return(Temp);
    }
Esempio n. 3
0
    public HitBox CreatePlayerVETO(Vector3 position)
    {
        // Create the visual effect // TODO: POOL THE VISUAL
        GameObject clonedParticle = (GameObject)Instantiate(_vetoGunShot, position, Quaternion.identity);

        Destroy(clonedParticle, 5.0f);

        // Make the hitbox
        HitBox hitbox = GetHitbox();

        hitbox.MakePlayerVETO();
        float   offsetX = hitbox.GetComponent <Collider>().bounds.extents.x;
        Vector3 offset  = new Vector3((GameManager.Player.Direction.x > 0 ? offsetX : -offsetX), 0, 0);

        hitbox.transform.position = GameManager.Player.transform.position + offset;
        return(hitbox);
    }
Esempio n. 4
0
    private void controlGameComponent(HitBox innerHitBox, HitBox outerHitBox)
    {
        Vector2 position = innerHitBox.GetComponent <Transform>().position;

        if (innerHitBox.getNoteIsTouching() && !outerHitBox.getNoteIsTouching())
        {
            Destroy(innerHitBox.getNoteObject());
            Ring ringObject = ((GameObject)Instantiate(ringPrefab, position, ringPrefab.transform.rotation)).GetComponent <Ring>();
            ringObject.createGreenRing();
            score = score + 500 + (((combo / 0.25f) / 2f) * (-speed / 0.25f)) + ((-speed) / 0.25f);
            combo = combo + 1;


            if (speed > speedLimit)
            {
                speed = speed - 0.25f;
            }

            if (spawnTime > spawnTimeLimit)
            {
                spawnTime = spawnTime - 0.025f;
            }
        }
        else if (innerHitBox.getNoteIsTouching() && outerHitBox.getNoteIsTouching())
        {
            Destroy(innerHitBox.getNoteObject());
            Ring ringObject = ((GameObject)Instantiate(ringPrefab, position, ringPrefab.transform.rotation)).GetComponent <Ring>();
            ringObject.createYellowRing();
            score = score + 250;
        }
        else
        {
            Ring ringObject = ((GameObject)Instantiate(ringPrefab, position, ringPrefab.transform.rotation)).GetComponent <Ring>();
            ringObject.createRedRing();
            combo = 0;
        }
    }
Esempio n. 5
0
    // actionType에 따른 공격 애니메이션 실행
    void PlayBattleAction(FanaticBattleType actionType)
    {
        switch (actionType)
        {
        case FanaticBattleType.Evade:
            m_isEvade        = true;
            isMoving         = false;
            TCP_setAnimation = false;
            SetMoveType(MoveType.Stay);
            m_desiredSpeed = 0;

            HitBox.GetComponent <BoxCollider>().enabled = false;
            m_Animator.SetInteger("Evade", 0);
            break;

        case FanaticBattleType.Attack1:
            m_isAttack       = true;
            isMoving         = false;
            TCP_setAnimation = false;
            SetMoveType(MoveType.Stay);
            m_desiredSpeed = 0;

            currentDamageValue = 25f;
            currentAttackType  = 0;
            CreateRandomActionTime(5f, 6f);

            m_Animator.SetInteger("BattleSTATE", (int)AnimBattleSTATE.Attack1);
            break;

        case FanaticBattleType.Attack2:
            m_isAttack       = true;
            isMoving         = false;
            TCP_setAnimation = false;
            SetMoveType(MoveType.Stay);
            m_desiredSpeed = 0;

            currentDamageValue = 20f;
            currentAttackType  = 0;
            CreateRandomActionTime(5f, 6f);

            m_Animator.SetInteger("BattleSTATE", (int)AnimBattleSTATE.Attack2);
            break;

        case FanaticBattleType.Attack3:
            m_isAttack       = true;
            isMoving         = false;
            TCP_setAnimation = false;
            SetMoveType(MoveType.Stay);
            m_desiredSpeed = 0;

            currentDamageValue = 15f;
            currentAttackType  = 0;
            CreateRandomActionTime(5f, 6f);

            m_Animator.SetInteger("BattleSTATE", (int)AnimBattleSTATE.Attack3);
            break;

        case FanaticBattleType.Max:
            break;
        }

        //print("공격 실행: " + actionType);
        m_RecvActionType = FanaticBattleType.Max;
    }
Esempio n. 6
0
 private bool GetBeat(HitBox hitter)
 {
     return(hitter.GetComponent <BeatingState>().CheckAndTransitionTo(stateMachine));
 }