// 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);
                }
            }
        }
    }
Esempio n. 2
0
 // 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);
    }
Esempio n. 4
0
    //all publicly exposed methods are here

    public void AttachPlayer(GameObject player)
    {
        ourPlayer   = player;
        ourAutoLock = player.GetComponent <AutoLockOn>();
    }
Esempio n. 5
0
    //all publicly exposed methods are here

    public void GetAssigned(AutoLockOn newAutolock)
    {
        myAutoLock = newAutolock;
    }