void InitHero() { if (hero == null) { GameObject obj = GameObject.Find("Hero_1(Clone)"); hero = obj.GetComponent <Hero_1> (); player = obj.GetComponent <playerTest>(); playerMovement = hero.GetComponent <PlayerMovement> (); } }
// Use this for initialization void Start() { state = -1; target = 0; pos = 0; speed = 5; moveSpeed = 5f; battleField = GameObject.Find("battleField"); gameObject.transform.Rotate(0, 90, 0); hero = this.GetComponent <Hero_1> (); playerMovement = hero.GetComponent <PlayerMovement> (); }