Esempio n. 1
0
    public virtual void ShrinkSelectedEntity()
    {
        if (selectedEntity != null)
        {
            if (hitEntityInfo.entityController != selectedEntity)
            {
                if (hitEntityInfo.entityController != null)
                {
                    selectedEntity.UnSelectEntity();
                    cameraController.RemoveTarget(selectedEntity.transform);

                    hitEntityInfo.entityController.SelectEntity();
                    cameraController.AddTarget(hitEntityInfo.entityController.transform);

                    selectedEntity = hitEntityInfo.entityController;
                }
            }

            selectedEntity.Shrink();
        }
        else
        {
            if (hitEntityInfo.entityController != null)
            {
                hitEntityInfo.entityController.SelectEntity();
                cameraController.AddTarget(hitEntityInfo.entityController.transform);

                selectedEntity = hitEntityInfo.entityController;

                selectedEntity.Shrink();
            }
        }
    }
Esempio n. 2
0
 private void AddTargetHookToCamera(GameObject hookTemp)
 {
     if (previousTargetHook != hookTemp)
     {
         camFollow.AddTarget(hookTemp.transform);
         if (previousTargetHook != null)
         {
             camFollow.RemoveTarget(previousTargetHook.transform);
         }
         previousTargetHook = hookTemp;
     }
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (Vector3.Distance(transform.position, player.position) < maxDistanceDetectPlayer)
        {
            if (!isAlreadyATarget)
            {
                camFollow.AddTarget(transform);
                isAlreadyATarget = true;
            }
        }
        else if (isAlreadyATarget)
        {
            RemoveCamTarget();
        }

        transform.Translate(transform.right * speed * Time.deltaTime);
    }
Esempio n. 4
0
 void Start()
 {
     Instantiate(followTarget);
     CameraFollow.AddTarget(followTarget);
 }