private void ChangeState(EnnemyState aState) { switch (aState) { case EnnemyState.Chase: { break; } case EnnemyState.Flee: { break; } case EnnemyState.Idle: { break; } case EnnemyState.Attack: { break; } case EnnemyState.Patrol: { break; } } m_State = aState; }
public void SwitchState(EnnemyState state) { if (currentState == state) { return; } this.currentState = state; switch (currentState) { case EnnemyState.WAITING: InitWaiting(); break; case EnnemyState.DIYING: break; case EnnemyState.STUNNED: InitStunned(); break; case EnnemyState.WALKING_FORWARD: InitWalking(); break; } }
private void OnEnable() { currentState = EnnemyState.wander; target = null; canAttack = true; currentAttack = RandomHelper.GetRandomInCollection(GetComponentsInChildren <EnnemyAttack>()); }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player"); rigidbody2D = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); collider2D = GetComponent <Collider2D>(); audioManager = FindObjectOfType <AudioManager>(); Init(); currentState = defaultState; }
private void SearchPlayer() { Collider[] playerCollider = Physics.OverlapSphere(transform.position, spotRange, playerLayer); if (playerCollider.Length > 0) { Transform player = playerCollider[0].transform; target = player; currentState = EnnemyState.follow; } }
private void OnTriggerStay2D(Collider2D collision) { GameObject go = collision.gameObject; EnnemyState es = go.GetComponent <EnnemyState>(); if (es && !collision.isTrigger) { var Dir = GetComponentInParent <PlayerState>().IsFacingRight ? 1 : -1; es.OnDamage(Damage, Dir * Knockback); } }
void OnTriggerEnter2D(Collider2D other) { PlayerController pc = other.GetComponent <PlayerController>(); if (pc == null) { //PlayerController pc_ = other.GetComponentInParent<PlayerController>(); // Don't kill weapon :( //if(pc_ == null) Destroy(other.gameObject); EnnemyState es = other.GetComponent <EnnemyState>(); if (!!es) { es.OnDamage(9999999, 0); } } }
protected Strategy( Mover mover, HandController handController, EnemyEnemyMemory enemyMemory, EnemyPickableMemory pickableMemory) { this.mover = mover; this.handController = handController; this.enemyMemory = enemyMemory; this.pickableMemory = pickableMemory; topLeft = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)); downRight = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)); roamingTarget = GetRandomLocation(); currentState = EnnemyState.Roaming; }
public void ChangeState(string state_name) { if (state_name == "walk") { state = EnnemyState.walk; } else if (state_name == "hit") { state = EnnemyState.hit; } else if (state_name == "impact") { state = EnnemyState.impact; } else { state = EnnemyState.idle; } }
protected virtual void Think() { currentState = EnnemyState.Idle; }
private bool CompareState(EnnemyState aState) { return(aState == m_State); }