Inheritance: MonoBehaviour
Exemplo n.º 1
0
    public int preState; //前一个state

    void Awake()
    {
        navAgent     = this.GetComponent <PolyNavAgent>();
        randomPatrol = this.GetComponent <PatrolRandomWaypoints>();
        patrol       = this.GetComponent <PatrolWaypoints>();
        curTarget    = GameObject.FindGameObjectWithTag("Player").transform;
        curState     = 0;
    }
    // Use this for initialization
    void Start()
    {
        Player          = GameObject.FindGameObjectWithTag("Player");
        EnemyCollider   = GetComponent <BoxCollider2D>();
        BodyAnimator    = GetComponent <Animator> ();
        LegAnimator     = transform.Find("Legs").gameObject.GetComponent <Animator>();
        RB2D            = GetComponent <Rigidbody2D>();
        spriteRenderer  = GetComponent <SpriteRenderer>();
        PolyNavagent    = GetComponent <PolyNavAgent>();
        PatrolWayPoints = GetComponent <PatrolWaypoints>();

        RegularColor = spriteRenderer.color;

        //Some enemys will have a set path and some won't
        if (WillUseWayPoints == true)
        {
            PatrolWayPoints.enabled = true;
        }
        else
        {
            PatrolWayPoints.enabled = false;
        }
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Awake()
 {
     chase = GetComponent<ChaseTarget>();
     patrol = GetComponent<PatrolWaypoints>();
 }
Exemplo n.º 4
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        patrol = GameObject.FindGameObjectWithTag("Waypoint").GetComponent <PatrolWaypoints>();

        randomSpot = Random.Range(0, patrol.patrolPoints.Length);
    }
    // Use this for initialization
    void Start()
    {
        m_PatrolScript = GetComponent <PatrolWaypoints>();

        m_ContinousPosition = transform.position;
    }