Пример #1
0
 // Use this for initialization
 void Start()
 {
     thisTransform = this.transform;
     singleton     = this;
     playerRB      = this.GetComponent <Rigidbody> ();
     force         = new Vector3(0, 0, 0);
     acceleration  = 8.0f;
     topSpeed      = 8.0f;
 }
Пример #2
0
    bool CheckIfPlayerInCone()
    {
        // get player position
        Vector3 playerPos = MitePlayer.GetPosition();
        // check if within sphere
        Vector3 playerDisplacement = playerPos - eyeCone.position;

        if (playerDisplacement.sqrMagnitude > range)
        {
            return(false);
        }
        // check if within angle
        if (Vector3.Angle(eyeCone.forward, playerDisplacement) > angle / 2)
        {
            hasPlayer = false;
            return(false);
        }
        return(true);
    }