Пример #1
0
            public override void Enter()
            {
                updateRefresh = 0.5f;

                Wander wanderBehaviour = ship.boid.GetBehaviour <Wander> ();

                if (wanderBehaviour != null)
                {
                    wanderBehaviour.enabled = true;
                    wanderBehaviour.weight  = 0.25f;
                }

                offsetPursueBehaviour = ship.boid.GetBehaviour <OffsetPursue> ();

                if ((offsetPursueBehaviour == null) || (escortingShip == null))
                {
                    AttackEmporer();
                }
                else
                {
                    offsetPursueBehaviour.enabled = true;
                    offsetPursueBehaviour.leader  = escortingShip;
                    offsetPursueBehaviour.RefreshOffset();
                }

                ship.StartCoroutine(IUpdate());
            }
Пример #2
0
            public override void Enter()
            {
                pursueBehaviour = ship.boid.GetBehaviour <Pursue> ();

                if (pursueBehaviour != null)
                {
                    pursueBehaviour.enabled         = true;
                    pursueBehaviour.target          = target.boid;
                    pursueBehaviour.desiredDistance = desiredDistance;
                }

                Wander wanderBehaviour = ship.boid.GetBehaviour <Wander> ();

                if (wanderBehaviour != null)
                {
                    wanderBehaviour.enabled = true;
                    wanderBehaviour.weight  = 10f;
                }

                Flee targetFlee = target.boid.GetBehaviour <Flee> ();

                if (targetFlee != null)
                {
                    targetFlee.avoidingBoids.Add(ship.transform);
                }

                target.pursuers++;
                ship.pursuing = target;

                ship.guns[0].enabled = true;

                ship.StartCoroutine(IUpdate());
            }
Пример #3
0
    // Use this for initialization
    protected override void Start()
    {
        Sight   = GetComponent <FieldOfView>();
        Search  = GetComponent <AStarSearch>();
        Path    = GetComponent <ASPathFollower>();
        Wander  = GetComponent <Wander>();
        Seek    = GetComponent <Seek>();
        Flee    = GetComponent <Flee>();
        Arrive  = GetComponent <Arrive>();
        Terrain = GameObject.Find("Terrain");

        Animator    = GetComponent <Animator>();
        SearchAgent = GetComponent <ASAgent>();

        State = new FiniteStateMachine <Velociraptor>(this);
        State.Change(V_Idle.Instance);

        Path.enabled = true;
        Path.path    = new ASPath();
        Path.enabled = false;

        collision_ticks = 0.0f;
        health_time     = 0.0f;
        hunger_time     = 0.0f;
        thirst_time     = 0.0f;

        base.Start();
    }
Пример #4
0
    private void Awake()
    {
        if (gameObject.activeSelf == true)
        {
            idle   = new Idle(this);
            rest   = new Rest(this);
            eat    = new Eat(this);
            wander = new Wander(this);
            chase  = new Chase(this);
            flee   = new Flee(this);
            attack = new Attack(this);
            dead   = new Dead(this);

            navAgent = GetComponentInParent <NavMeshAgent>();

            tracker = GameObject.FindGameObjectWithTag("Tracker").GetComponent <Tracking>();

            damageOutput = gameObject.GetComponentsInChildren <Damage>();

            if (useAnimator == true)
            {
                anim = GetComponent <Animator>();
            }

            if (dynamicWandering == false)
            {
                spawnpoint = transform.position;
            }
        }
    }
Пример #5
0
    private void Awake()
    {
        myWander  = this.GetComponentInChildren <Wander>();
        myGetLaid = this.GetComponentInChildren <GetLaid>();

        RandomiseStats();
    }
Пример #6
0
 void Awake()
 {
     rb2d = GetComponent<Rigidbody2D>();
     enemyFireScript = GetComponent<BasicEnemyFire>();
     wanderScript = GetComponent<Wander>();
     colliderSize = GetComponent<BoxCollider2D>().size;
 }
Пример #7
0
 public void WanderOn()
 {
     if (!behaviours.Contains(Wander.GetInstance()))
     {
         behaviours.Add(Wander.GetInstance());
     }
 }
Пример #8
0
 void Start()
 {
     wander           = GetComponent <Wander>();
     theAudio         = FindObjectOfType <AudioManager>();
     thePlayerStat    = FindObjectOfType <Player_Stat>();
     current_interMWT = inter_MoveWaitTime;
 }
            public override void Enter()
            {
                ship.StartCoroutine(IUpdate());

                patrolBehaviour = ship.boid.GetBehaviour <OffsetPursue> ();
                Pursue pursueBehaviour = ship.boid.GetBehaviour <Pursue> ();

                Wander wanderBehaviour = ship.boid.GetBehaviour <Wander> ();

                if (wanderBehaviour != null)
                {
                    wanderBehaviour.enabled = true;
                    wanderBehaviour.weight  = 0.25f;
                }

                if (patrolBehaviour != null)
                {
                    patrolBehaviour.enabled = true;
                }

                if (pursueBehaviour != null)
                {
                    pursueBehaviour.enabled = false;
                }
            }
Пример #10
0
        public void Setup()
        {
            GameObject playerGameObject =
                MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/Player"));

            Player = playerGameObject.GetComponent <player>();

            GameObject enemyFGameObject =
                MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/EnemyFollow"));

            enemyFollow = enemyFGameObject.GetComponent <Follow>();

            GameObject enemyWEGameObject =
                MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/EnemyExplode"));

            enemyWE = enemyWEGameObject.GetComponent <WanderExplode>();

            GameObject enemyESGameObject =
                MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/succ"));

            enemySucc = enemyESGameObject.GetComponent <EnemySuck>();

            GameObject enemyEPGameObject =
                MonoBehaviour.Instantiate(Resources.Load <GameObject>("Prefabs/EnemyDropPuddle"));

            enemyPuddle = enemyEPGameObject.GetComponent <Wander>();
        }
Пример #11
0
    // Use this for initialization
    public void Starta(GameObject plane, GameObject swamps, float nodeSize)
    {
        fixedDeadCollider = false;

        poi            = Vector3.zero;
        health         = 100.0f;
        seesPlayer     = false;
        seesDeadPeople = false;
        hearsSomething = false;
        disturbed      = false;

        reachGoal  = GetComponent <ReachGoal> ();
        wander     = GetComponent <Wander> ();
        standstill = GetComponent <StandStill> ();
        patrol     = GetComponent <Patrol> ();
        gc         = player.GetComponent <GoalControl> ();

        reachGoal.plane    = plane;
        reachGoal.swamps   = swamps;
        reachGoal.nodeSize = nodeSize;
        reachGoal.goalPos  = poi;
        reachGoal.Starta();
        wander.Starta();
        patrol.Starta();
        standstill.Starta();
        anim = GetComponent <Animation> ();
        anim.CrossFade(idle);
        walkingSpeed = 10.0f;
        gunShot      = this.GetComponents <AudioSource> ()[0];

        lr       = this.GetComponentInParent <LineRenderer> ();
        seenTime = 0f;
//		Debug.Log (transform.name);
    }
Пример #12
0
 private void Start()
 {
     wander         = GetComponent <Wander>();
     flee           = GetComponent <Flee>();
     zombieAnimator = GetComponent <Animator>();
     zombieAnimator.GetBehaviours <ZombieState>().ToList().ForEach(zs => zs.zombie = this);
 }
Пример #13
0
 void Awake()
 {
     wanderScript = GetComponent<Wander>();
     fireScript = GetComponent<BasicEnemyFire>();
     rb2d = GetComponent<Rigidbody2D>();
     boxCollider2d = GetComponent<BoxCollider2D>();
 }
Пример #14
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            UnityEngine.EventSystems.PointerEventData eventData = new UnityEngine.EventSystems.PointerEventData(null);
            eventData.position = Input.mousePosition;

            List <UnityEngine.EventSystems.RaycastResult> results = new List <UnityEngine.EventSystems.RaycastResult>();
            raycaster.Raycast(eventData, results);
            foreach (var result in results)
            {
                if (result.gameObject.layer == LayerMask.NameToLayer("Octo"))
                {
                    Wander wander = result.gameObject.GetComponent <Wander>();
                    if (wander != null)
                    {
                        wander.OnPressed(Input.mousePosition);
                    }
                    else
                    {
                        CapturedOcto captured = result.gameObject.GetComponent <CapturedOcto>();
                        if (captured != null)
                        {
                            captured.OnPressed();
                        }
                    }
                }
                else if (result.gameObject.layer == LayerMask.NameToLayer("CapturedOcto"))
                {
                    CapturedOcto captured = result.gameObject.GetComponent <CapturedOcto>();
                    captured.OnPressed();
                }
            }
        }
    }
Пример #15
0
    public Steering GetSteering()
    {
        wanderOrientation += Random.Range(-1.0f, 1.0f) * wanderRate;
        wanderForce        = Wander.GetSteering(npc, wanderForce, wanderCooldown, wanderRate, wanderOrientation, wanderCircleOffset, wanderCircleRadius, maxAccel, timeToTarget, visibleRays);

        return(GetSteering(npc, groupArea, decayCoefficient, maxAccel, visibleRays, timeToTarget, wanderCooldown, wanderRate, wanderOrientation, wanderCircleOffset, wanderCircleRadius, wanderForce, cohesionPriority, separationPriority, alignmentPriority, wanderPriority));
    }
Пример #16
0
    void OnTriggerEnter(Collider other)
    {
        //transform.localPosition = new Vector3 (transform.localPosition.x, transform.localPosition.y * -1f, 0f);
        Wander wander = transform.parent.GetComponent <Wander> ();

        wander.turn += 180f;
    }
Пример #17
0
    void Awake()
    {
        steeringBehaviours = GetComponents <SteeringBehaviour>();

        Wander wander = GetComponent <Wander>();

        if (wander != null)
        {
            initialWanderWeight = wander.weight;
        }

        Flocking flocking = GetComponent <Flocking>();

        if (flocking != null)
        {
            initialAlignmentWeight  = flocking.alignmentWeight;
            initialCohesionWeight   = flocking.cohesionWeight;
            initialSeperationWeight = flocking.seperationWeight;
        }

        // Get the physical collider (not the trigger)
        BoxCollider2D[] boxColliders = GetComponents <BoxCollider2D>();
        foreach (BoxCollider2D bc in boxColliders)
        {
            if (!bc.isTrigger)
            {
                boxCollider = bc;
                break;
            }
        }
    }
Пример #18
0
    // Use this for initialization
    protected override void Start()
    {
        anim          = GetComponent <Animator>();
        fov           = GetComponent <FieldOfView>();
        ankyFleeing   = GetComponent <Flee>();
        ankyWandering = GetComponent <Wander>();
        // Assert default animation booleans and floats
        anim.SetBool("isIdle", true);
        anim.SetBool("isEating", false);
        anim.SetBool("isDrinking", false);
        anim.SetBool("isAlerted", false);
        anim.SetBool("isGrazing", false);
        anim.SetBool("isAttacking", false);
        anim.SetBool("isFleeing", false);
        anim.SetBool("isDead", false);
        anim.SetFloat("speedMod", 1.0f);
        // This with GetBool and GetFloat allows
        // you to see how to change the flag parameters in the animation controller

        stateMachine = new StateMachine <MyAnky>(this);
        stateMachine.ChangeState(StateBeginning.Instance);

        gameTimer = Time.time;

        Debug.Log("Started Anky!");

        base.Start();
    }
Пример #19
0
    // Use this for initialization
    protected override void Start()
    {
        waterSource   = GameObject.Find("Daylight Water");
        thirst        = 100;
        health        = 100;
        energy        = 100;
        currentState  = ankyState.IDLE;
        ankyWander    = GetComponent <Wander>();
        ankyFlee      = GetComponent <Flee>();
        ankyView      = GetComponent <FieldOfView>();
        ankyFace      = GetComponent <Face>();
        ankyFaceEnemy = GetComponent <FaceEnemy>();
        ankyPursue    = GetComponent <Pursue>();
        ankySeek      = GetComponent <Seek>();
        ankyAgent     = GetComponent <Agent>();
        anim          = GetComponent <Animator>();

        // Assert default animation booleans and floats
        anim.SetBool("isIdle", true);
        anim.SetBool("isEating", false);
        anim.SetBool("isDrinking", false);
        anim.SetBool("isAlerted", false);
        anim.SetBool("isGrazing", false);
        anim.SetBool("isAttacking", false);
        anim.SetBool("isFleeing", false);
        anim.SetBool("isDead", false);
        anim.SetFloat("speedMod", 1.0f);
        // This with GetBool and GetFloat allows
        // you to see how to change the flag parameters in the animation controller

        base.Start();
    }
Пример #20
0
    //Function to create leader ships
    void CreateLeaders(Vector3 newpos)
    {
        GameObject leader = GameObject.Instantiate <GameObject> (prefab);

        leader.transform.parent   = this.transform;
        leader.transform.position = this.transform.TransformPoint(newpos);
        leader.transform.rotation = this.transform.rotation;

        //add steering behaviours
        Wander w    = leader.AddComponent <Wander>();
        Seek   seek = leader.AddComponent <Seek> ();

        seek.enabled = !seek.enabled;         //disable seek behaviour
        ObstacleAvoidance obavd = leader.AddComponent <ObstacleAvoidance> ();
        //Change speed of boid
        Boid b = leader.GetComponent <Boid> ();

        b.maxSpeed = 2;
        //Create followers of leader
        for (int i = 1; i <= followers; i++)
        {
            Vector3 offset = new Vector3(gap * i, 0, -gap * i);
            CreateFollower(offset, leader.GetComponent <Boid> ());
            offset = new Vector3(-gap * i, 0, -gap * i);
            CreateFollower(offset, leader.GetComponent <Boid> ());
        }
    }
Пример #21
0
    // Use this for initialization
    protected override void Start()
    {
        Sight    = GetComponent <FieldOfView>();
        Search   = GetComponent <AStarSearch>();
        Path     = GetComponent <ASPathFollower>();
        Wander   = GetComponent <Wander>();
        Flee     = GetComponent <Flee>();
        Face     = GetComponent <Face>();
        Agent    = GetComponent <Agent>();
        Animator = GetComponent <Animator>();

        Terrain     = GameObject.Find("Terrain");
        SearchAgent = GetComponent <ASAgent>();
        herdCentre  = GameObject.Find("HerdCentre").gameObject;

        Path.enabled = true;
        Path.path    = new ASPath();
        Path.enabled = false;

        State = new FiniteStateMachine <Ankylosaurus>(this);
        State.Change(Idle.Instance);

        collision_time = 0.0f;
        health_time    = 0.0f;
        hunger_time    = 0.0f;
        thirst_time    = 0.0f;

        base.Start();
    }
Пример #22
0
    public FSMState curState; // current state

    // Use this for initialization
    void Awake()
    {
        wander   = GetComponent <Wander>();
        animator = GetComponent <Animator>();

        currentChokingDuration = chokeDuration;
        curState = FSMState.Wander;
    }
Пример #23
0
 // Use this for initialization
 void Start()
 {
     timer  = transitionTime;
     agent  = GetComponent <NavMeshAgent>();
     wander = GetComponent <Wander>();
     seek   = GetComponent <SeekBehaviour>();
     flee   = GetComponent <RandFlee>();
 }
Пример #24
0
    private void Awake()
    {
        critter = GetComponent <Critter>();
        wander  = GetComponent <Wander>();
        mtt     = GetComponent <MoveToTarget>();

        wander.speed = critter.speed;
    }
Пример #25
0
 void Awake()
 {
     projectilePool = GameObject.Find("FireballPool").GetComponent<StackPool>();
     animator = GetComponent<Animator>();
     mainCam = GameObject.Find("Main Camera").GetComponent<Camera>();
     wanderScript = GetComponent<Wander>();
     rb2d = GetComponent<Rigidbody2D>();
 }
Пример #26
0
    // Use this for initialization
    void Start()
    {
        char_kinematic = GetComponent <Kinematic>();
        seek           = GetComponent <KinematicSeek>();
        arrive         = GetComponent <KinematicArrive>();

        wander = GetComponent <Wander>();
    }
Пример #27
0
 public static Wander GetInstance()
 {
     if (instance == null)
     {
         instance = new Wander();
     }
     return(instance);
 }
Пример #28
0
    // Start is called before the first frame update
    void Start()
    {
        myMoveType           = new Wander();
        myMoveType.character = this;

        myRotateType           = new LookWhereGoing();
        myRotateType.character = this;
    }
Пример #29
0
 public AIState(Agent _agent, Wander _wander, Flee _flee, Seek _seek, Face _face)
 {
     agent  = _agent;
     wander = _wander;
     flee   = _flee;
     seek   = _seek;
     face   = _face;
 }
Пример #30
0
 private void Start()
 {
     animator     = GetComponent <Animator>();
     aiAgent      = this.GetComponent <AIAgent>();
     rb           = GetComponent <Rigidbody>();
     agent        = this.GetComponent <NavMeshAgent>();
     wanderScript = GetComponent <Wander>();
     playerStats  = GameObject.Find("Player").GetComponent <PlayerStats>();
     target       = GameObject.Find("Player").GetComponent <Transform>();
 }
Пример #31
0
 void SetupWanderScripts()
 {
     wanderScripts = new Wander[points.Length];
     for (int i = 0; i < points.Length; i++)
     {
         Wander w = points[i].gameObject.AddComponent <Wander>();
         w.Initialize(wanderSpeedRange, timeBetweenDirectionChangeRange);
         wanderScripts[i] = w;
     }
 }
Пример #32
0
    // Start is called before the first frame update
    void Start()
    {
        myMoveType           = new Wander();
        myMoveType.character = this;
        myMoveType.target    = myTarget;

        myRotateType           = new Face();
        myRotateType.character = this;
        myRotateType.target    = myTarget;
    }
Пример #33
0
        private void Awake()
        {
            _enemyConfig  = GameSettings.Get.EnemyConfig;
            _stateMachine = new StateMachine();

            _fieldOfView = Instantiate(_enemyConfig.FieldOfViewPrefab, Vector3.zero, Quaternion.identity)
                           .GetComponent <FieldOfView>();

            // Store component references.
            var navMeshAgent       = GetComponent <NavMeshAgent>();
            var character          = GetComponent <ThirdPersonCharacter>();
            var animator           = GetComponent <Animator>();
            var movementController = GetComponent <CustomMovementController>();

            // Create wanted states.
            var staticState = new StaticState();
            var wander      = new Wander(this, movementController, navMeshAgent, animator);
            var chase       = new Chase(this, movementController, navMeshAgent, animator);
            var attack      = new Attack(this);
            var scouting    = new Scouting(this, animator);

            // Assign state transitions
            void At(IState from, IState to, Func <bool> condition) => _stateMachine.AddTransition(from, to, condition);

            // TODO Move attack state to any state

            At(staticState, wander, NotStatic());

            At(wander, attack, FoundPlayer());
            At(wander, scouting, Scouting());
            At(wander, chase, ChasingPlayer());

            At(scouting, attack, FoundPlayer());
            At(scouting, wander, ScoutingFinished());
            At(scouting, chase, ChasingPlayer());

            At(attack, chase, ChasingPlayer());

            At(chase, attack, FoundPlayer());
            At(chase, wander, NotChasingPlayer());

            // Set start state.
            _stateMachine.SetState(staticState);

            // Transition logic between states.
            Func <bool> NotStatic() => () => !_isStatic;

            Func <bool> FoundPlayer() => () => Target != null;

            Func <bool> ChasingPlayer() => () => IsChasing;
            Func <bool> NotChasingPlayer() => () => !IsChasing;

            Func <bool> Scouting() => () => IsScouting;
            Func <bool> ScoutingFinished() => () => !IsScouting;
        }
Пример #34
0
    // Use this for initialization
    public override void Start()
    {
        fleeScript = GetComponent<Flee>();
        wanderScript = GetComponent<Wander> ();
        base.Start ();
        fleeDist = rayDist;
        interDist = 3.0f * rayDist;
        isReachingGoal = false;

        actualDist = Vector3.Distance (transform.position, goal.transform.position);
        setScripts ();
    }
Пример #35
0
    void Awake()
    {
        squaredAttackDistance = attackDistance * attackDistance;

        rb2d = GetComponent<Rigidbody2D>();
        boxCollider2d = GetComponent<BoxCollider2D>();
        animator = GetComponent<Animator>();
        wanderScript = GetComponent<Wander>();
        fsm = new FiniteStateMachine<MeleeEnemyAI>(this, MeleeEnemyIdleState.Instance);

        meleeEnemies.Add(this);
    }
Пример #36
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public Behaviors()
 {
     Alignment = new Alignment();
     Arrive = new Arrive();
     Cohesion = new Cohesion();
     Evade = new Evade();
     Flee = new Flee();
     Hide = new Hide();
     Interpose = new Interpose();
     ObstacleAvoidance = new ObstacleAvoidance();
     OffsetPursuit = new OffsetPursuit();
     PathFollowing = new PathFollowing();
     Pursuit = new Pursuit();
     Seek = new Seek();
     Separation = new Separation();
     WallAvoidance = new WallAvoidance();
     Wander = new Wander();
 }
Пример #37
0
	protected void enemyStart(){
		
		characterStart ();
		sphere.renderer.material.color = Color.red;
		grid = (Grid)GameObject.FindObjectOfType (typeof(Grid));
		pathing = (PathFinding)GameObject.FindObjectOfType (typeof(PathFinding));
		experienceBase = 25;
		xpGiven = false;
		lootGiven = false;
		lootFactory = GameObject.FindObjectOfType<LootFactory> ();
		
		// networking: makes sure each enemy is properly instantiated even on another game instance that didn't run the EnemyFactory code.
		target = (Fighter) GameObject.FindObjectOfType (typeof (Fighter)); // for the enemies perspective target is always fighter
		sorcerer = (Sorcerer)SorcererInstanceManager.getSorcerer (); // sorcerer = (Sorcerer) GameObject.FindObjectOfType (typeof (Sorcerer));

		
		level = target.level;
		initializePrimaryStats();
		initializeSecondaryStatsBase();
		initializeSecondaryStats();
		calculateSecondaryStats();
		health = maxHealth;
		energy = maxEnergy;
		
		activeSkill1 = (BasicMelee)GetComponent<BasicMelee>();

		
		this.transform.parent = GameObject.Find("Enemies").transform;

		// networking:
		enemyNetworkScript = (EnemyNetworkScript)GetComponent<EnemyNetworkScript> ();
		
		collider = GetComponent<CapsuleCollider>();
		wanderScript = GetComponent<Wander> ();
		arriveScript = GetComponent<Arrive> ();
	}
Пример #38
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find("Player");
     cc = GetComponent<CharacterController> ();
     wander = GetComponent<Wander> ();
 }
 void Awake()
 {
     wanderController = GetComponent<Wander> ();
     rb = GetComponent<Rigidbody>();
     navAgent = GetComponent<NavMeshAgent>();
 }
Пример #40
0
    // Use this for initialization
    public void Starta(GameObject plane, GameObject swamps, float nodeSize)
    {
        fixedDeadCollider = false;

        poi = Vector3.zero;
        health = 100.0f;
        seesPlayer = false;
        seesDeadPeople = false;
        hearsSomething = false;
        disturbed = false;

        reachGoal = GetComponent<ReachGoal> ();
        wander = GetComponent<Wander> ();
        standstill = GetComponent<StandStill> ();
        patrol = GetComponent<Patrol> ();
        gc = player.GetComponent<GoalControl> ();

        reachGoal.plane = plane;
        reachGoal.swamps = swamps;
        reachGoal.nodeSize = nodeSize;
        reachGoal.goalPos = poi;
        reachGoal.Starta ();
        wander.Starta ();
        patrol.Starta ();
        standstill.Starta ();
        anim = GetComponent<Animation> ();
        anim.CrossFade (idle);
        walkingSpeed = 10.0f;
        gunShot = this.GetComponents<AudioSource> ()[0];

        lr = this.GetComponentInParent<LineRenderer> ();
        seenTime = 0f;
        //		Debug.Log (transform.name);
    }
//	float nextCue;
//	float cueStep = 2f;
	// Use this for initialization
	void Start () {
		airplane = GameObject.Find ("Airplane").GetComponent<Transform>();
		//get leader
		leader = GameObject.FindGameObjectWithTag ("Leader").GetComponent<Wander>();
	}
Пример #42
0
    // Use this for initialization
    public void Starta(GameObject plane, float nodeSize, Vector3 sP)
    {
        fixedDeadCollider = false;

        poi = Vector3.zero;
        health = 100.0f;
        seesPlayer = false;
        lastSeen = Vector3.zero;
        lastSeenForward = Vector3.zero;
        seesDeadPeople = false;
        hearsSomething = false;
        disturbed = false;
        isDead = false;
        addToDeadSet = false;
        takingCover = false;
        coverSpot = Vector3.zero;
        reachedCover = false;
        sniperPosKnown = false;
        sniperPos = sP;
        isGoaling = false;
        isGoingToSeenPlayerPos = false;
        isGoingToCover = false;
        dirSearchCountDown = 0.0f;

        reachGoal = GetComponent<ReachGoal> ();
        wander = GetComponent<Wander> ();
        standstill = GetComponent<StandStill> ();
        patrol = GetComponent<Patrol> ();
        gc = player.GetComponent<GoalControl> ();

        reachGoal.plane = plane;
        reachGoal.nodeSize = nodeSize;
        reachGoal.goalPos = poi;
        reachGoal.sniperPos = sniperPos;
        reachGoal.Starta ();
        wander.Starta ();
        patrol.Starta ();
        standstill.Starta ();
        takeCover = new TakeCover (reachGoal.state.sGrid.hiddenSpaceCost,
                                   reachGoal.state.sGrid.grid, reachGoal.state.sGrid.spaceCostScalars);

        anim = GetComponent<Animation> ();
        anim.CrossFade (idle);
        walkingSpeed = 10.0f;
        gunShot = this.GetComponents<AudioSource> ()[0];

        lr = this.GetComponentInParent<LineRenderer> ();
        seenTime = 0f;
        alertLevel = 0;
        maxAlertLevel = 3;
        needsToRaiseAlertLevel = false;
        isReloading = false;
        isShooting = false;
        ammoCount = 0;
        //		Debug.Log (transform.name);
    }