// Update is called once per frame void Update() { if (lockedOn) { if (!ourAutoLock && assignedPlayer) { ourAutoLock = assignedPlayer.GetComponent<AutoLockOn>(); } if (ourAutoLock.AlreadyTargeted(enemySighted)) { if (useOurTargeting) { sightImage.color = Color.red; } } else { //this cannot be handled by an animator, because it cannot seem to handle the rotation timeSoFar += Time.deltaTime; targetingSight.transform.rotation = Quaternion.Euler(0, 0, (1080 * (timeSoFar / neededTime))); Color newColor = sightImage.color; newColor.a = (timeSoFar / neededTime); if (useOurTargeting) { sightImage.color = newColor; } if (timeSoFar >= neededTime) { if (useOurTargeting) { sightImage.color = Color.red; } ourAutoLock.NewTarget(enemySighted.gameObject); } } } }
// Update is called once per frame void Update() { if (!ourPlayer && assignedPlayer) { ourPlayer = assignedPlayer; ourAutoLock = ourPlayer.GetComponent <AutoLockOn>(); } transform.forward = ourPlayer.transform.forward; transform.position = ourPlayer.transform.position; }
// Update is called once per frame void Update() { if (!ourPlayer && assignedPlayer) { ourPlayer = assignedPlayer; ourAutoLock = ourPlayer.GetComponent <AutoLockOn>(); } Vector3 ourOffset = ourAutoLock.ArmorOffset(); transform.position = (ourPlayer.transform.position + ourOffset); }
//all publicly exposed methods are here public void AttachPlayer(GameObject player) { ourPlayer = player; ourAutoLock = player.GetComponent <AutoLockOn>(); }
//all publicly exposed methods are here public void GetAssigned(AutoLockOn newAutolock) { myAutoLock = newAutolock; }