Esempio n. 1
0
    internal void Awake()
    {
        m_physics     = GetComponent <PhysicsSS>();
        m_hitboxMaker = GetComponent <HitboxMaker>();
        m_queuedFX    = new Dictionary <AttackFXInfo, float> ();

        m_progress         = AttackState.INACTIVE;
        m_progressEndTimes = new Dictionary <AttackState, float>()
        {
            { AttackState.STARTUP, m_AttackAnimInfo.StartUpTime },
            { AttackState.ATTACK, m_AttackAnimInfo.StartUpTime + m_AttackAnimInfo.AttackTime },
            { AttackState.RECOVERY, m_AttackAnimInfo.StartUpTime + m_AttackAnimInfo.AttackTime + m_AttackAnimInfo.RecoveryTime },
            { AttackState.INACTIVE, 0 }
        };
        m_AttackDelay     = 0f;
        m_inTickFunctions = new Dictionary <AttackState, Action>()
        {
            { AttackState.STARTUP, StartUpTick },
            { AttackState.ATTACK, AttackTick },
            { AttackState.RECOVERY, RecoveryTick },
            { AttackState.INACTIVE, ConcludeTick },
        };
        m_progressCalls = new Dictionary <AttackState, Action>()
        {
            { AttackState.STARTUP, OnStartUp },
            { AttackState.ATTACK, OnAttack },
            { AttackState.RECOVERY, OnRecovery },
            { AttackState.INACTIVE, OnConclude }
        };
    }
Esempio n. 2
0
 protected void init()
 {
     m_anim        = GetComponent <AnimatorSprite> ();
     m_physics     = GetComponent <PhysicsTD> ();
     m_attackable  = GetComponent <Attackable> ();
     m_faction     = gameObject.GetComponent <Attackable> ().faction;
     m_hitboxMaker = GetComponent <HitboxMaker> ();
     endAttack();
     AttackInfo[] at = gameObject.GetComponents <AttackInfo> ();
     foreach (AttackInfo a in at)
     {
         if (!attacks.ContainsKey(a.attackName))
         {
             attacks.Add(a.attackName, a);
         }
     }
     m_animationSpeed = 1f;
 }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     anim        = GetComponent <Animator> ();
     movement    = GetComponent <Movement> ();
     gameManager = FindObjectOfType <GameManager> ();
     attackable  = GetComponent <Attackable> ();
     myFac       = gameObject.GetComponent <Attackable> ().faction;
     hbm         = GetComponent <HitboxMaker> ();
     endAttack();
     AttackInfo[] at = gameObject.GetComponents <AttackInfo> ();
     foreach (AttackInfo a in at)
     {
         if (!attacks.ContainsKey(a.attackName))
         {
             attacks.Add(a.attackName, a);
         }
     }
     beatTime       = 60.0f / FindObjectOfType <BeatTracker> ().Tempo;
     animationRatio = FindObjectOfType <BeatTracker> ().Tempo / 100.0f;
 }
Esempio n. 4
0
    internal void Awake()
    {
        m_physics     = GetComponent <PhysicsTD>();
        m_hitboxMaker = GetComponent <HitboxMaker>();

        m_progress         = AttackState.INACTIVE;
        m_progressEndTimes = new Dictionary <AttackState, float>()
        {
            { AttackState.STARTUP, StartUpTime },
            { AttackState.ATTACK, StartUpTime + AttackTime },
            { AttackState.RECOVERY, StartUpTime + AttackTime + RecoveryTime },
            { AttackState.INACTIVE, 0 }
        };
        m_progressCalls = new Dictionary <AttackState, Action>()
        {
            { AttackState.STARTUP, OnAttack },
            { AttackState.ATTACK, OnRecovery },
            { AttackState.RECOVERY, OnConclude },
            { AttackState.INACTIVE, OnStartUp }
        };
    }
Esempio n. 5
0
    public override void recoveryTick()
    {
        if (timeSinceAttack == 0f)
        {
            numHits = 1;
        }
        if (timeSinceAttack > 0.2f && numHits == 1)
        {
            numHits = 2;
            HitboxMaker hbm     = GetComponent <HitboxMaker> ();
            Vector2     realKB  = new Vector2(2f, 10f);
            Vector2     realOff = new Vector2(1.5f, -1f);
            if (GetComponent <Movement> ().facingLeft)
            {
                realOff.x = realOff.x * -1f;
                realKB.x  = realKB.x * -1f;
            }
            hbm.stun = 0.5f;
            hbm.createHitbox(new Vector2(2.5f, 0.8f), realOff, 5f, 0.2f, realKB, true, GetComponent <Attackable>().faction, true);
        }
        else if (timeSinceAttack > 0.4f && numHits == 2)
        {
            numHits = 3;
            HitboxMaker hbm     = GetComponent <HitboxMaker> ();
            Vector2     realKB  = new Vector2(10f, 18f);
            Vector2     realOff = new Vector2(1.5f, -0.5f);
            if (GetComponent <Movement> ().facingLeft)
            {
                realOff.x = realOff.x * -1f;
                realKB.x  = realKB.x * -1f;
            }

            hbm.stun = 1.0f;
            hbm.createHitbox(new Vector2(2.5f, 0.9f), realOff, 5f, 0.5f, realKB, true, GetComponent <Attackable>().faction, true);
        }

        timeSinceAttack += Time.deltaTime;
    }
Esempio n. 6
0
 public void SetOwner(GameObject go)
 {
     m_charBase    = go.GetComponent <CharacterBase>();
     m_hitboxMaker = go.GetComponent <HitboxMaker>();
 }