예제 #1
0
 //calculate cooldown
 void CoolDown( )
 {
     if (counter.IsFinished)
     {
         state = EAttackState.WAITING;
     }
 }
예제 #2
0
    void Start()
    {
        monHP     = 40;
        monDir    = Random.Range(0, 2);
        monAtk    = 5;
        monAtkSpd = 0.666f;
        monSpd    = 3.75f;
        isAtk     = false;
        isReached = 0;

        player       = GameObject.Find("Player");
        eliteMonster = this.gameObject;
        detectRng    = GameObject.Find(eliteMonster.name + "/Range");
        gridMgr      = player.GetComponentInChildren <GridManager>();
        monMgr       = GameObject.Find("GameManager").GetComponent <MonsterManager>();
        textMesh     = this.GetComponentInChildren <TextMesh>();

        monPos = new Vector3(Random.Range(1, 69), 0, Random.Range(1, 69));

        eliteMonster.transform.position = monPos;

        atkState = new EAttackState(this);
        ptlState = new EPatrolState(this);
        chsState = new EChaseState(this);

        detectRng.GetComponent <Renderer>().enabled = false;
        textMesh.GetComponent <Renderer>().enabled  = false;

        curState = ptlState;
    }
예제 #3
0
 //-------------method
 public AAttack(float cd, System.Action attackFinishedAction = null, bool IsCanAttack = true)
 {
     this.cd                    = cd;
     this.bCanAttack            = IsCanAttack;
     this.attackFinishedAction += attackFinishedAction;
     this.state                 = EAttackState.WAITING;
     counter                    = new Timer(cd);
 }
예제 #4
0
 /// <summary>MUST call this method to enter cooldown</summary>
 public void AttackFinished( )
 {
     if (attackFinishedAction != null)
     {
         attackFinishedAction( );
     }
     state = EAttackState.COOLDOWN;
     counter.Reset( );
 }
예제 #5
0
 private void Awake()
 {
     attackState    = new EAttackState(this);
     idleState      = new EIdleState(this);
     deadState      = new EDeadState(this);
     challengeState = new EChallengeState(this);
     zombie_anim    = GetComponent <Animator>();
     navMeshAgent   = GetComponent <NavMeshAgent>();
     bus            = GameObject.FindGameObjectWithTag("Bus");
 }
예제 #6
0
    public virtual EHitNotificationType GetHitNotificationType(EAttackResult attackResult, bool isInBlockingStance, bool isCrouching, bool isFacingRight, PlayerAttackComponent victimAttackComponent)
    {
        if (victimAttackComponent.GetCurrentAttackLogic() != null)
        {
            EAttackState victimAttackState = victimAttackComponent.CurrentAttackState;
            if (victimAttackState == EAttackState.Startup || victimAttackState == EAttackState.Active)
            {
                return(EHitNotificationType.Counter);
            }
        }

        if (m_Attack.m_NeededStanceList.Contains(EPlayerStance.Jump) && m_MovementComponent.IsJumping())
        {
            if (m_CurrentCrossupCoroutine != null)
            {
                m_AttackComponent.StopCoroutine(m_CurrentCrossupCoroutine);
            }

            m_CurrentCrossupCoroutine = ValidateCrossup_Coroutine(victimAttackComponent.transform);
            m_AttackComponent.StartCoroutine(m_CurrentCrossupCoroutine);
        }

        return(EHitNotificationType.None);
    }
예제 #7
0
 /// <summary>Call this method to cause Damage</summary>
 public void Attack( )
 {
     state      = EAttackState.ATTACKING;
     bCanAttack = false;
 }