Example #1
0
 public NPC_Alert(NPC_BehaviorAI npcStatePattern)
 {
     npc      = npcStatePattern;
     npcSight = npc.npcSight;
     npcMove  = npc.npcMove;
     npcStats = npc.npcStats;
 }
Example #2
0
	void Awake()
    {
        npcAI = GetComponentInParent<NPC_AI>();
        npcSight = GetComponentInParent<NPC_Sight>();
        flash = GetComponentInChildren<Light>();
        if(flash.type == LightType.Spot)
            flash.spotAngle = lightAngle;
        playerHead = GameObject.FindGameObjectWithTag(Tags.playerHead);
    }
        void SetInitialReferences()
        {
            npcSight = new NPC_Sight(this);
            npcMove  = new NPC_Movement(this);
            npcStats = new NPC_Stats(); //GetComponent<NPC_Stats>();

            myNavMeshAgent = GetComponent <NavMeshAgent>();

            currentState = patrolState;
        }
Example #4
0
    public float angleResponseTime = 0.6f;          // Response time for turning an angle into angularSpeed.
    
    void Awake()
    {
        // Zuweisung von Variablen
        #region
        initialPosition = new Vector3(transform.position.x, 0f, transform.position.z);
        initialForward = transform.forward;
        playerTracker = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<PlayerTracker>();
        npcSight = GetComponent<NPC_Sight>();
        npcAI = GetComponent<NPC_AI>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();
        #endregion

        nav.updateRotation = false;
        
        anim.SetLayerWeight(1, 0.9f);
        anim.SetLayerWeight(2, 1f);
        
        deadZone *= Mathf.Deg2Rad;
    }
Example #5
0
    void Awake()
    {
        // Zuweisung von Variablen
        #region
        npcSight = GetComponent<NPC_Sight>();
        nav = GetComponent<NavMeshAgent>();
        col = GetComponent<SphereCollider>();
        player = GameObject.FindGameObjectWithTag(Tags.player).transform;
        playerHealth = player.GetComponent<Player_Health>();
        playerMovement = player.GetComponent<Player_Movement>();
        audioAssets = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<AudioAssets>();
        alert = 0f;
        waitTimer = 0f;
        #endregion

        // Zuweisung der Delegaten
        #region
        PlayerTracker.Stepped += ReactToStep;
        PlayerTracker.Jumped += ReactToJump;
        PlayerTracker.ShotFired += ReactToShot;
        PlayerTracker.DoorMoved += ReactToDoorSound;
        #endregion
    }
Example #6
0
    float minRange = 5;                //  The range for when the npc should move to target location.  If target is within range, npc will not move.


    public NPC_Movement(NPC_BehaviorAI _npc)
    {
        npc      = _npc;
        npcStats = npc.npcStats;
        npcSight = npc.npcSight;
    }