blob: a7af21ff65e283824a9a250a65740473d3c05d23 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour {
private Vector2 start;
void OnTriggerStay2D(Collider2D other) {
GameObject ogo = other.gameObject;
switch (ogo.tag) {
case "Player":
CharacterControl script = ogo.GetComponent<CharacterControl>();
script.Damaged();
break;
}
}
void Start() {
start = this.transform.position;
}
public void Reset() {
Debug.Log(this);
this.transform.position = start;
GetComponent<SpriteRenderer>().enabled = true;
GetComponent<BoxCollider2D>().enabled = true;
}
}
|