// Update is called once per frame void Update() { if (myUnit == null) { myUnit = gameObject.GetComponent <UnitBehavior>(); return; } if (Target != null) { //move towards target during battle. eventually replace this entirely. //when in battle we shouldn't setoverworlddestination to anything because our turn queue will. if (myUnit.inBattle && !myUnit.isDead && isAlive) { //myUnit.SetOverworldDestination(Target.transform.position); } else { myUnit.SetOverworldDestination(Vector3.zero); } } //handle for the frame where we die via unitbehavior and need to trigger death animation. if (myUnit.isDead && isAlive) { isAlive = false; gameObject.transform.localScale *= 0.5f; } }
// Use this for initialization void Start() { //player = gameObject.transform.GetComponentInParent<UnitBehavior>(); // added to link the camera to the parent with the unitbehavior script clientPlayers = new List <UnitBehavior>(); clientPlayers.Add(player); //add connected players somehow???? targetPosition = player.transform.position; player.SetOverworldDestination(targetPosition); ClickEffect = GameObject.Instantiate(ClickObject, targetPosition, Quaternion.identity); mouseHeld = false; CameraControllerOfflineScript playerCameraScript = mainCamera.GetComponent <CameraControllerOfflineScript>(); if (playerCameraScript != null) { playerCameraScript.Target = player.gameObject; } }
// Update is called once per frame void Update() { if (player == null && !set) { player = GameObject.Find("OverWorldController").GetComponent <OverWorldControllerScript>().getPlayer(); return; } else if (!set) { set = true; gameObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(OnClickFunction); } if (overcontroller == null) { overcontroller = GameObject.Find("OverWorldController").GetComponent <OverWorldControllerScript>(); } else if (hovered && isdown) { Debug.Log("should be affecting the motion."); player.SetOverworldDestination(Vector3.zero); //overcontroller.MoveOnClick = !DisablesOverworld; } }
//all posible turns capable of being executed. //expected to be a turn update public void MoveToLocation() { self.SetOverworldDestination(Target.position); TargetLocator.transform.position = Target.position; }