コード例 #1
0
 public BaseMobState(GameObject self)
 {
     this.self  = self;
     controller = self.GetComponent <PlayerController>();
     motor      = self.GetComponent <GridMotor>();
     player     = GameObject.Find("Player");
 }
コード例 #2
0
ファイル: PlayerController.cs プロジェクト: akokulu/FQ
    // public event StateChangedEventHandler OnStateChanged
    // {
    //  get { return sm.OnStateChanged; }
    //  set { sm.OnStateChanged = value; }
    // }

    void Start()
    {
        motor = GetComponent <GridMotor>();
        sm.RegisterState(PlayerState.Idle, new IdleState(gameObject));
        sm.RegisterState(PlayerState.Moving, new MovingState(gameObject));
        sm.RegisterState(PlayerState.Attacking, new AttackingState(gameObject));
        sm.RegisterState(PlayerState.Blocking, new BlockingState(gameObject));
        sm.RegisterState(PlayerState.Dying, new DyingState(gameObject));

        sm.ChangeState(PlayerState.Start, PlayerState.Idle);
    }
コード例 #3
0
ファイル: GridNavigation.cs プロジェクト: akokulu/FQ
 public void RequestPath(GridMotor motor, Transform target, OnPathFound callback)
 {
     if (null != callback)
     {
         if (!isSearching)
         {
             OnSearchStart(new PathRequest()
             {
                 motor = motor, source = motor.transform.position, target = target.position, callback = callback
             });
         }
         else
         {
             requests.Enqueue(new PathRequest()
             {
                 motor = motor, source = motor.transform.position, target = target.position, callback = callback
             });
         }
     }
 }
コード例 #4
0
ファイル: PlayerController.cs プロジェクト: akokulu/FQ
 public BasePlayerState(GameObject self)
 {
     this.self  = self;
     controller = self.GetComponent <PlayerController>();
     motor      = self.GetComponent <GridMotor>();
 }