protected override void Initialize() { //Get the list of points //GameObject[] patrolPoints = GameObject.FindGameObjectsWithTag ("Patrol Point"); //Get the target enemy(Player) //objTarget = GameObject.FindGameObjectsWithTag ("Target"); animator = GetComponent <Animator>(); animalStat = GetComponent <AnimalStat>(); ai = GetComponent <AnimalMove>(); }
public void AddAnimal(IAnimal animal) { if (animal == null) { return; } AnimalMove move = new AnimalMove(animal); // 设置移动属性 animal.SetProp((int)WorldObjProp.MoveSpeed, ClientGlobal.Instance().MainPlayer.GetProp((int)WorldObjProp.MoveSpeed)); move.m_Animal = animal; move.state = AnimalMove.State.Idle; animal.SendMessage(EntityMessage.EntityCommand_SetPos, GetRandomPos()); m_Animals.Add((int)move.m_Animal.GetID(), move); }
void Start() { m_AnimalMove = GameObject.FindObjectOfType <AnimalMove>().gameObject.GetComponent <AnimalMove>(); m_Player = Transform.FindObjectOfType <PlayerMove>().transform; }