Пример #1
0
    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;
 }