Exemple #1
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Half-turn"))
     {
         int dir = (int)enemyDir * -1;
         enemyDir = (direction_e)dir;
     }
 }
Exemple #2
0
 // 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;
     }
 }
Exemple #3
0
 void setPlayerDir(direction_e dir)
 {
     prevDir   = playerDir;
     playerDir = dir;
 }
Exemple #4
0
 // Start is called before the first frame update
 void Start()
 {
     playerDir = direction_e.UNDEFINED;
     prevDir   = direction_e.UNDEFINED;
 }