// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     npcMovement    = animator.GetComponent <NpcMovement>();
     transform      = animator.GetComponent <Transform>();
     getDestination = animator.GetComponent <GetDestination>();
     destination    = getDestination.SetDestination();
 }
Esempio n. 2
0
 protected override void Start()
 {
     m_Type = BuildingType.PASSENGERTRAIN;
     base.Start();
     NPCs      = FindObjectOfType <NpcMovement>();
     anim      = GetComponentInChildren <Animator>();
     inStation = false;
 }
    void Awake()
    {
        theController = GetComponent <NpcMovement>();

        patrolState     = new PatrolState(this, theController);
        chaseState      = new ChaseState(this, theController);
        controlledState = new ControlledState(this, theController);
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        View     = GetComponent <FieldOfView>();
        Movement = GetComponent <NpcMovement>();

        SetState("goodVibe");
        StartCoroutine("RefreshEnemyState", .5f);
    }
Esempio n. 5
0
 public void ToCanControl(NpcMovement enemy)
 {
     if (playerState == VujStates.NotControlling)
     {
         controlledTripulant = enemy;
         canControlFlag.SetActive(true);
         playerState = VujStates.CanControl;
     }
 }
 private void Start()
 {
     if (_soundManager == null)
     {
         _soundManager = FindObjectOfType <SoundManagement>();
     }
     _complexMove = GetComponent <ComplexMove>();
     _npcMovement = GetComponent <NpcMovement>();
     StartCoroutine(RotarChecking());
 }
    /**
    * Randonly pick the next waypoint for the NPC
    */
    private void chooseNextRoute(NpcMovement npcMov)
    {
        //throw new NotImplementedException();

        int randomInt = UnityEngine.Random.Range(0, 2);

        if (randomInt < 1)
        {
            Debug.Log("A route chosen");
            npcMov.SetNextWaypoint(branchWaypoints_A[0]);
        }
        else {
            Debug.Log("B route chosen");
            npcMov.SetNextWaypoint(branchWaypoints_B[0]);
        }
    }
Esempio n. 8
0
    //Transform firePoint;

    // Use this for initialization
    void Start()
    {
        rb            = GetComponent <Rigidbody2D>();
        theController = GetComponentInParent <NpcMovement>();
        //brazo.localEulerAngles = Vector3.forward;
    }
Esempio n. 9
0
 public ControlledState(StateEnemyBehavior enemy, NpcMovement controller)
 {
     this.enemy    = enemy;
     theController = controller;
 }
Esempio n. 10
0
 /**
  * Get movement script reference from newly created npc game object
  * Get next waypoint location and set this value on npc movement script
  */
 void releaseNpc( GameObject newNpc )
 {
     GameObject firstWPoint = getFirstWaypoint();
     npcMovement = newNpc.GetComponent<NpcMovement>();
     npcMovement.SetNextWaypoint(firstWPoint);
 }