void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("Half-turn")) { int dir = (int)enemyDir * -1; enemyDir = (direction_e)dir; } }
// Start is called before the first frame update void Start() { baseHp = hp; box = GetComponentsInChildren <BoxCollider2D>()[1]; animator = GetComponent <Animator>(); spawnPos = new Vector2(transform.position.x, transform.position.y); isDead = false; isInvicible = false; if (Random.Range(0, 10000) % 2 == 0) { enemyDir = direction_e.LEFT; } else { enemyDir = direction_e.RIGHT; } }
void setPlayerDir(direction_e dir) { prevDir = playerDir; playerDir = dir; }
// Start is called before the first frame update void Start() { playerDir = direction_e.UNDEFINED; prevDir = direction_e.UNDEFINED; }