예제 #1
0
파일: Fisher.cs 프로젝트: imgr8/FishingMine
    void Awake()
    {
        this.spinning = this.spinningGameObject.GetComponent<ISpinning> ();

        if (this.spinning == null) {
            throw new UnityException ("Spinning are not initialized");
        }

        this.spinning.SetOwner (this);

        this.boat = this.boatGameObject.GetComponent<IBoat> ();

        if (this.boat == null) {
            throw new UnityException ("Boat are not initialized");
        }

        this.spinning.OnEndTryCatch += (ICatchable catchedStaff) => {

            if (catchedStaff != null) {
                catchedStaff.Use(this);

                StartCoroutine(StartAfterDelay());

            } else {
                this.ChangeState(FisherState.LookingFor);
            }

        };

        this.ChangeState (FisherState.Nothing); // Началное состояние обязательно задается в Awake
    }
예제 #2
0
 public void SetOwner(ISpinning spinning)
 {
     this.spinning = spinning;
 }