Esempio n. 1
0
 public PnjMoveToPositionState(ObjectManager curObject, Vector3 target) : base(curObject)
 {
     stateName      = "PNJ_MOVE_TO_PLACE_STATE";
     this.curObject = curObject;
     curPnj         = (PnjManager)this.curObject;
     this.target    = target;
     agent          = curPnj.GetAgent();
 }
Esempio n. 2
0
    //STATE GESTION______________________________________________________________________________

    public override void Enter()
    {
        curPnj.GetAgent().SetDestination(curPnj.transform.position);
        curPnj.GetAnimator().SetFloat("MoveSpeed", 0f);
        curPnj.transform.LookAt(curPlayer.gameObject.transform);

        //event_______________
        curPnj.TalkingEvent();
    }
Esempio n. 3
0
 public PursuitPlayerState(ObjectManager curObject) : base(curObject)
 {
     stateName      = "PURSUIT_PLAYER_STATE";
     this.curObject = curObject;
     curPnj         = (PnjManager)this.curObject;
     curPlayer      = PlayerManager.instance;
     agent          = curPnj.GetAgent();
     baseSpeed      = agent.speed;
 }
Esempio n. 4
0
    //WANDER______________________________________________________________________________

    public void SetWanderDestination()
    {
        Vector3 newPos = RandomNavSphere(curObject.transform.position, wanderRadius, -1);

        curPnj.GetAgent().SetDestination(newPos);
        timer        = 0;
        wanderTimer  = Random.Range(2f, 5f);
        wanderRadius = Random.Range(2f, 3f);
    }
Esempio n. 5
0
    //WANDER______________________________________________________________________________

    public void SetWanderDestination()
    {
        Vector3 newPos = Vector3.zero;

        if (!IsFarFromTarget())
        {
            newPos = RandomNavSphere(curObject.transform.position, wanderRadius, -1);
        }
        else
        {
            newPos = target;
        }
        curPnj.GetAgent().SetDestination(newPos);
        timer        = 0;
        wanderTimer  = Random.Range(2f, 5f);
        wanderRadius = Random.Range(2f, 3f);
    }