Exemplo n.º 1
0
    private void Awake()
    {
        m_hWeapon = this.GetComponent<Weapon>();
        Owner = GetComponent<Actor>();
        m_hIdle             = new StateIdle(this);
        m_hPatrol           = new StatePatrol(this);

        switch ((int)AimMode)
        {
            case 1:
                m_hPatrol.Next = new StateAimBallistic(this); 
                break;
            case 2:
                m_hPatrol.Next = new StateAimDirect(this); 
                break;
        }


        m_hPatrol.Next.Next = m_hPatrol;

        m_hCurrent          = m_hPatrol;
        m_hCurrent.OnStateEnter();

        
    }
Exemplo n.º 2
0
    private void Awake()
    {
        receiver = GetComponent<ControllerWheels>();
        sphereCollider = this.GetComponent<SphereCollider>();
        //Debug.LogWarning("HARDCODED");
        sphereCollider.isTrigger = true;
        sphereCollider.radius = 20f;

        receiverColliders = GetComponents<Collider>().ToList();
        receiverColliders = GetComponentsInChildren<Collider>().ToList();
        receiverColliders.ForEach(hC => Physics.IgnoreCollision(sphereCollider, hC));

        m_hRigidbody = this.GetComponent<Rigidbody>();

        //FSM
        idle = new StateIdle(this);
        patrol = new StatePatrol(this);
        onAir = new StateOnAir(this);
        wait = new StateWait(this);

        patrol.Idle = idle;
        patrol.OnAir = onAir;
        onAir.Wait = wait;
        wait.Patrol = patrol;

        currentState = idle;
        currentState.OnStateEnter();
    }
 public float actualDistance; // the distance to the target
 void Awake()
 {
     followingState = new StateFollow(this);
     patrolingState = new StatePatrol(this);
     firingState    = new StateFire(this);
     actualState    = patrolingState;
 }
Exemplo n.º 4
0
 public override void Update()
 {
     // if AI saw the player, then exit idle state and start chasing
     if (CanSeePlayer())
     {
         nextState = new StatePursue(npc, agent, anim, player);
         stage     = EVENT.EXIT;
     }
     // Set a check to exit the Update stage and go to next one (Exit), otherwise will be stuck in Update forever
     // This condition creates 10% chance to exit Update stage
     else if (Random.Range(0, 100) < 10)
     {
         nextState = new StatePatrol(npc, agent, anim, player);
         stage     = EVENT.EXIT;
     }
 }
Exemplo n.º 5
0
	void Awake()
	{
		helicopter		= this.GetComponent<ControllerPlayerHeli>();
		
		idle			= new StateIdle(this);
		lift			= new StateLift(this);
		patrol			= new StatePatrol(this);
		landing			= new StateLanding(this);

		lift.Patrol		= patrol;
		patrol.Landing	= landing;
		patrol.Idle		= idle;
		landing.Idle	= idle;

		currentState = idle;
		idle.OnStateEnter();
	}
Exemplo n.º 6
0
	public virtual StatePatrol Patrol(Vector3[] pointList){
		StatePatrol state = new StatePatrol (this, pointList);
		StateContext.SetState (state);
		return state;
	}