Esempio n. 1
0
 void OnTriggerStay(Collider other)
 {
     if (other.gameObject.GetComponent <GuardPatrol>())
     {
         enemy = other.gameObject.GetComponent <GuardPatrol>();
     }
 }
Esempio n. 2
0
 void OnTriggerExit(Collider other)
 {
     if (other.gameObject.GetComponent <GuardPatrol>())
     {
         enemy = null;
     }
 }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        //waitBeforePatrolResumes = 1.0f;

        agent = gameObject.GetComponent <NavMeshAgent>();

        fov   = gameObject.GetComponent <FieldOfView>();
        gpat  = gameObject.GetComponent <GuardPatrol>();
        gpat2 = gameObject.GetComponent <GuardPatrolv2>();

        playerObject = GameObject.FindGameObjectWithTag("Player");

        gC = GameObject.FindGameObjectWithTag("GameController");

        caughtPlayer = false;

        guardState = 1;

        patFire = 0;

        fovEnumerator = fovLerpChange(1.0f);

        alarmCalledBy = null;

        hidingSpotWaitTime = 1.75f;

        startSecondLook = false;

        soundTargetSet = false;

        platePrefab = GameObject.Find("GoldenPlateSafety");

        gobletPrefab = GameObject.Find("GoldenGobletSafety");
    }
Esempio n. 4
0
    public override void OnStateEnter()
    {
        base.OnStateEnter();

        GuardPatrol patrol = context.PatrolRoute;

        waypoints = patrol != null?patrol.GetWaypoints() : new Waypoint[0];

        waypointIndex = context.LastWaypointIndex;
        navMeshAgent  = context.GetComponent <NavMeshAgent>();
    }
Esempio n. 5
0
 void OnTriggerEnter(Collider other)
 {
     //print (other.tag);
     if (other.tag.Equals("Guard"))
     {
         GuardPatrol gp = other.GetComponent <GuardPatrol> ();
         if (gp != null)
         {
             gp.waypointReached(this);
         }
     }
 }
Esempio n. 6
0
    void InitializeRanger()
    {
        pathingScript   = gameObject.GetComponent <GuardPatrol>();
        rb              = gameObject.GetComponent <Rigidbody2D>();
        spriteComponent = gameObject.GetComponent <SpriteRenderer>();
        players         = GameObject.FindGameObjectsWithTag("Player");
        playerOne       = players[0];
        playerTwo       = players[1];

        agent = gameObject.GetComponent <NavMeshAgent>();
        agent.updateRotation = false;
        agent.updateUpAxis   = false;
        agent.Warp(transform.position);
        agent.SetDestination(gameObject.GetComponent <GuardPatrol>().currentCheckpoint.transform.position);
        agent.speed = chaseSpeed;
    }
Esempio n. 7
0
        public Task <GuardPatrol> FindNearestPatrol(GeoCoordinates targetLocation, IEnumerable <GuardPatrol> patrols)
        {
            GuardPatrol result = patrols.FirstOrDefault();
            double      minDistanceInMeters = result.GeoLocation.DistanceToInMeters(targetLocation);

            foreach (var guardPatrol in patrols)
            {
                var currentDistanceToTargetInMeters = guardPatrol.GeoLocation.DistanceToInMeters(targetLocation);
                if (currentDistanceToTargetInMeters < minDistanceInMeters)
                {
                    result = guardPatrol;
                    minDistanceInMeters = currentDistanceToTargetInMeters;
                }
            }

            return(Task.FromResult(result));
        }
Esempio n. 8
0
    //**************************************************
    // Player Input Commands
    //*************************

    public void OnSlash(InputAction.CallbackContext context)
    {
        if (context.started && !isDead)
        {
            m_Animator.SetTrigger("Slash");
            runningAnimation = 4;
            isAttacking      = true;
            timeRemaining    = 0.4f;
            timerIsRunning   = true;
            // TODO set forward collider trigger as active
            enemy = damageArc.getEnemy();
            if (enemy)
            {
                enemy.setDamage(damage);
            }
        }
    }
Esempio n. 9
0
    void OnTriggerStay(Collider other)
    {
        //print (other.tag);
        if (other.tag.Equals("Fox"))
        {
            RaycastHit hit = new RaycastHit();
            Physics.Linecast(transform.parent.position, other.transform.position, out hit);

            if (hit.collider.tag.Equals("Fox"))
            {
                //print (other.transform.position);
                if (Time.realtimeSinceStartup > lastTime + cd)
                {
                    lastTime = Time.realtimeSinceStartup;
                    GameObject gameObject = (GameObject)Instantiate(g, other.transform.position, other.transform.rotation);
                    gameObject.SetActive(true);
                    GuardPatrol patrol = GetComponentInParent <GuardPatrol> ();
                    patrol.setVisionPoint(gameObject.GetComponent <VisionPoint> ());
                }
            }

            /*Destroy(other.gameObject);*/
        }
    }
Esempio n. 10
0
 private void Start()
 {
     col = GetComponent <SphereCollider>();
     gp  = GetComponent <GuardPatrol>();
     gi  = GetComponent <GuardInvestigate>();
 }
Esempio n. 11
0
 // Use this for initialization
 void Start()
 {
     guard = GetComponentInParent <GuardPatrol> ();
 }