Esempio n. 1
0
    public void Start()
    {
        if (Input.GetJoystickNames().Length == 0)
        {
            keyBoardKeys.SetActive(true);
            gamepadKeys.SetActive(false);
        }
        else
        {
            keyBoardKeys.SetActive(false);
            gamepadKeys.SetActive(true);
        }


        wheelSound = playerWheelSource.volume;
        if (batteries == null)
        {
            batteries = GameObject.FindObjectsOfType <BatteryPickup>();
        }
        if (enemies == null)
        {
            enemies = GameObject.FindObjectsOfType <AIAgent>();
        }

        player = StealthPlayerController.getInstance();
        currentCheckpointPosition = player.transform.position;
    }
Esempio n. 2
0
 void OnTriggerEnter(Collider col)
 {
     if (col.gameObject == StealthPlayerController.getInstance().gameObject)
     {
         GameLogic.instance.SetCheckpoint(respawnPosition.position);
     }
 }
Esempio n. 3
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject == StealthPlayerController.getInstance().gameObject)
     {
         StealthPlayerController.getInstance().ResetEnergy();
     }
 }
Esempio n. 4
0
 void OnTriggerEnter(Collider col)
 {
     if (col.CompareTag("Player"))
     {
         StealthPlayerController.getInstance().hidden = true;
         GameObject.Instantiate(EffectsManager.getInstance().boxEffect, transform.position, Quaternion.identity);
     }
 }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     cam          = Camera.main;
     player       = StealthPlayerController.getInstance();
     currentState = idleState;
     currentState.Start(this);
     globalState.Start(this);
 }
    public void OnTriggerEnter(Collider col)
    {
        StealthPlayerController player = StealthPlayerController.getInstance();

        if (col.gameObject == player.gameObject)
        {
            GameLogic.instance.ShowMessageBox(text);
            Destroy(gameObject);
        }
    }
Esempio n. 7
0
    public void OnTriggerEnter(Collider col)
    {
        StealthPlayerController player = StealthPlayerController.getInstance();

        if (col.gameObject == player.gameObject)
        {
            GameLogic.instance.EnablePlayerSkill(type);

            Destroy(gameObject);
        }
    }
Esempio n. 8
0
    public void OnTriggerEnter(Collider col)
    {
        StealthPlayerController player = StealthPlayerController.getInstance();

        if (col.gameObject == player.gameObject)
        {
            ConsoleText.getInstance().ShowMessage("Battery acquired");
            player.AddEnergy(val);
            GameObject.Instantiate(EffectsManager.getInstance().itemEffect, transform.position, Quaternion.identity);
            gameObject.SetActive(false);
        }
    }
Esempio n. 9
0
    bool canSeecharacter(Transform character)
    {
        if (!aiAgent.aiEnabled && !testSight)
        {
            return(false);
        }
        if (character == StealthPlayerController.getInstance().transform)
        {
            if (StealthPlayerController.getInstance().hovering)
            {
                return(false);
            }
            if (StealthPlayerController.getInstance().cloaked)
            {
                return(false);
            }
            if (StealthPlayerController.getInstance().hidden)
            {
                if (sightState != SightStates.seeingEnemy)
                {
                    return(false);
                }
            }
        }

        Vector3 vectorToEnemy = Vector3.Normalize(character.transform.position - transform.position);

        if (Vector3.Distance(transform.position, character.position) <= viewDistance)
        {
            if (!requireAngleOfView)
            {
                return(true);
            }
            if (Vector3.Angle(transform.forward, vectorToEnemy) < viewAngle)
            {
                if (!requireLineOfSight)
                {
                    return(true);
                }
                if (!checkLineOfSight(character))
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     playerTransform    = StealthPlayerController.getInstance().transform;
     lastPlayerPosition = playerTransform.position;
 }