public void changeChannel() { if (islocked) { return; } islocked = true; if (Channel == herostate.right) { //iTween.MoveTo(hero,hero.transform.position + new Vector3(-2, 0, 0), 1.5f); Channel = herostate.left; iTween.MoveTo(hero, iTween.Hash( "position", hero.transform.position + new Vector3(-2, 0, 0), "time", 0.4f, "easetype", iTween.EaseType.easeInBack, "oncomplete", "unlock" )); } else { //iTween.MoveTo(hero,hero.transform.position + new Vector3(2, 0, 0), 1.5f); Channel = herostate.right; iTween.MoveTo(hero, iTween.Hash( "position", hero.transform.position + new Vector3(2, 0, 0), "time", 0.4f, "easetype", iTween.EaseType.easeInBack, "oncomplete", "unlock" )); } }
// Use this for initialization void Start() { if (this.transform.position.x > 0) { channel = herostate.right; hero = GameObject.Find("rightHero"); } else { channel = herostate.left; hero = GameObject.Find("leftHero"); } }