Example #1
0
    void Start()
    {
        _controller = GetComponent<CharacterController>();
        _transform = GetComponent<Transform>();
                _eyes = transform.Find ("Eyes");
        player = GameObject.Find("Player").GetComponent<Transform>();
        if (player == null)
            Debug.LogError("No player on scene");
        if (string.IsNullOrEmpty(strTag))
            Debug.LogError("No waypoint tag given");

        index = 0;
        range = 2.5f; attackRange = 200f;

        GameObject[] gos = GameObject.FindGameObjectsWithTag(strTag);
        foreach (GameObject go in gos)
        {
            WaypointScript script = go.GetComponent<WaypointScript>();
            waypoint.Add(script.index, go.transform);
        }
        GetComponent<Animation>()["victory"].wrapMode = WrapMode.Once;

        delFunc = this.Walk;
        delEnum = null;
        del = true;

        isCorouting = false;
        seenAround = false;
        layerMask = ~layerMask;
    }
Example #2
0
 void Walk()
 {
     if ((_transform.position - waypoint[index].position).sqrMagnitude > range)
     {
         Move(waypoint[index]);
         GetComponent<Animation>().CrossFade("walk");
     }
     else
     {
         switch (index)
         {
             case 0:
                 del = false;
                 isCorouting = false;
                 delEnum = this.Victory;
                 break;
             case 1:
                 del = false;
                 isCorouting = false;
                 delEnum = this.Wait;
                 break;
             default:
                 NextIndex(); break;
         }
     }
 }
Example #3
0
 /**
  * プレイヤーを見つけていない時;
  * 徘徊AI;
  **/
 void Walk()
 {
     transform.localScale = new Vector3(3, 5, 5);
     if ((_transform.position - waypoint[index].position).sqrMagnitude > range){
         Move(waypoint[index]);
         animation.CrossFade("walk");
         attackFlag = false;
     }else{
         switch (index)
         {
             case 0:
                 del = false;
                 isCorouting = false;
                 delEnum = this.Victory;
                 break;
             case 1:
                 del = false;
                 isCorouting = false;
                 delEnum = this.Wait;
                 break;
             default:
                 NextIndex(); break;
         }
     }
 }