Exemple #1
0
    // Use this for initialization
    void Start()
    {
        myBody      = this.GetComponent <Rigidbody2D>();
        targetCheck = gameObject.GetComponentInChildren <TargetCheck>();
        target      = GameObject.FindGameObjectWithTag("Player");

        //Animation
        if (animated)
        {
            anim = GetComponent <Animator>();
        }

        //enemy movement pattern while patrolling; will move in a clockwise square
        xPatrolMovement = new int[] { 1, 0, -1, 0 };
        yPatrolMovement = new int[] { 0, -1, 0, 1 };
        //choose a random starting movement
        patrolMovementIndex = Random.Range(0, 3);

        nextPatrolMovement = Time.time;

        //nextWiggle = Time.time;


        playerController = GameObject.Find("Player").GetComponent <PlayerController>();
    }
Exemple #2
0
 void Start()
 {
     rb          = this.gameObject.GetComponent <Rigidbody2D>();
     animator    = this.gameObject.GetComponent <Animator>();
     targetCheck = this.gameObject.GetComponentInChildren <TargetCheck>();
     dashingTime = baseDashingTime;
     setHealthUI(health, baseHealth);
     setManaUI(mana, baseMana);
 }
 public bool AllowTarget(Actor actor) => TargetCheck.Evaluate(actor);