Exemplo n.º 1
0
    void Start()
    {
        //  GS = GameObject.FindGameObjectWithTag("GameState");
        // GSscript = GS.GetComponent<GameState>();
        // enemyRenderer = enemy.GetComponent<Renderer>();
        cyclopsController = GetComponent <CharacterController>();
        anim = GetComponent <Animator>();
        anim.SetBool("Moving", true);
        //Field of View Script / Player Detection
        cyclopsSight = GetComponent <CyclopsSight>();

        //Nav Mesh agent sets up the mesh that our characters can move on.
        nav = GetComponent <NavMeshAgent>();
        nav.updatePosition = true;
        nav.updateRotation = true;
        alive = true;

        //char references
        player          = GameObject.Find("Player");
        playerTransform = player.transform;
        state           = CyclopsAI.State.PATROLLING;
        cyclops         = GameObject.Find("Cyclops");

        //Set the first waypoint
        wayPointIndex = 0;
        //Get the list of waypoint objects.
        wayPoints = GameObject.FindGameObjectsWithTag("CyclopsWaypoint");

        audioSources = new AudioSource[audioClips.Length];
        int i = 0;

        while (i < audioClips.Length)
        {
            audioSources[i]      = this.gameObject.AddComponent <AudioSource>() as AudioSource;
            audioSources[i].clip = audioClips[i];
            i++;
        }
        audioSources[0].playOnAwake = false;
        audioSources[0].loop        = false;
        audioSources[1].playOnAwake = false;
        audioSources[1].loop        = true;
        audioSources[2].playOnAwake = false;
        audioSources[2].loop        = false;
        audioSources[3].playOnAwake = false;
        audioSources[3].loop        = true;
        audioSources[4].playOnAwake = false;
        audioSources[4].loop        = true;
        audioSources[5].playOnAwake = false;
        audioSources[5].loop        = true;
        audioSources[6].playOnAwake = false;
        audioSources[6].loop        = false;

        StartCoroutine("FSM");
    }
Exemplo n.º 2
0
 void Start()
 {
     //Find reference to current light and player objects.
     currentLight     = GetComponent <Light>();
     playerObject     = GameObject.Find("Player");
     playerController = playerObject.GetComponent <PlayerController>();
     //and cyclops
     cyclopsObject = GameObject.Find("Cyclops");
     cyclopsSight  = cyclopsObject.GetComponent <CyclopsSight>();
     //Init light values
     currentLight.intensity = 1.5f;
     currentLight.range     = range;
     targetIntensity        = highIntensity;
     obj = GameObject.FindGameObjectWithTag("MainCamera");
 }
Exemplo n.º 3
0
    void Start()
    {
        //  GS = GameObject.FindGameObjectWithTag("GameState");
        // GSscript = GS.GetComponent<GameState>();
        // enemyRenderer = enemy.GetComponent<Renderer>();
        cyclopsController = GetComponent<CharacterController>();
        anim = GetComponent<Animator>();
        anim.SetBool("Moving", true);
        //Field of View Script / Player Detection
        cyclopsSight = GetComponent<CyclopsSight>();

        //Nav Mesh agent sets up the mesh that our characters can move on.
        nav = GetComponent<NavMeshAgent>();
        nav.updatePosition = true;
        nav.updateRotation = true;
        alive = true;

        //char references
        player = GameObject.Find("Player");
        playerTransform = player.transform;
        state = CyclopsAI.State.PATROLLING;
        cyclops = GameObject.Find("Cyclops");

        //Set the first waypoint
        wayPointIndex = 0;
        //Get the list of waypoint objects.
        wayPoints = GameObject.FindGameObjectsWithTag("CyclopsWaypoint");

        audioSources = new AudioSource[audioClips.Length];
        int i = 0;
        while (i < audioClips.Length)
        {
            audioSources[i] = this.gameObject.AddComponent<AudioSource>() as AudioSource;
            audioSources[i].clip = audioClips[i];
            i++;
        }
        audioSources[0].playOnAwake = false;
        audioSources[0].loop = false;
        audioSources[1].playOnAwake = false;
        audioSources[1].loop = true;
        audioSources[2].playOnAwake = false;
        audioSources[2].loop = false;
        audioSources[3].playOnAwake = false;
        audioSources[3].loop = true;
        audioSources[4].playOnAwake = false;
        audioSources[4].loop = true;
        audioSources[5].playOnAwake = false;
        audioSources[5].loop = true;
        audioSources[6].playOnAwake = false;
        audioSources[6].loop = false;

        StartCoroutine("FSM");
    }
Exemplo n.º 4
0
 void Start()
 {
     //Find reference to current light and player objects.
     currentLight = GetComponent<Light>();
     playerObject = GameObject.Find("Player");
     playerController = playerObject.GetComponent<PlayerController>();
     //and cyclops
     cyclopsObject = GameObject.Find("Cyclops");
     cyclopsSight = cyclopsObject.GetComponent<CyclopsSight>();
     //Init light values
     currentLight.intensity = 1.5f;
     currentLight.range = range;
     targetIntensity = highIntensity;
     obj = GameObject.FindGameObjectWithTag("MainCamera");
 }