Ejemplo n.º 1
0
 public SimpleFishBehaviour(ICatchable obj)
 {
     this.catchable = obj;
     this.obj = obj.GameObject.transform;
     this.sea = obj.Sea;
     //this.speed = obj.GameObject.GetComponent<Fish>().speed;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <remarks>
 /// It is private because the class is a singleton.
 /// </remarks>
 private TileFactory()
 {
     this.mountain = new Mountain();
     this.lowland = new Lowland();
     this.forest = new Forest();
     this.sea = new Sea();
     this.desert = new Desert();
 }
Ejemplo n.º 3
0
    public void Init(IFishing fishing, ISea sea, IFisher fisher, Action method = null)
    {
        this.fishing = fishing;
        this.sea = sea;
        this.fisher = fisher;

        // Пример понижения уровня
        //this.fishing.NumLevel--;
    }
Ejemplo n.º 4
0
    public SimpleStarBehaviour(ICatchable obj)
    {
        this.catchable = obj;
        this.obj = obj.GameObject.transform;
        this.sea = obj.Sea;
        //		this.speed = obj.GameObject.GetComponent<Fish>().speed;

        this.moveDirection = (UnityEngine.Random.Range (0, 2) == 1 ? MoveDirection.Up : MoveDirection.Down);
    }
Ejemplo n.º 5
0
    public void Init(IFishing fishing, ISea sea, IFisher fisher, Action method = null)
    {
        this.fishing = fishing;
        this.sea = sea;
        this.fisher = fisher;
        this.minimumMoneyBaseCoeff += 50 * (fishing.NumLevel - 1);

        this.fishing.OnEarnedUpdate += IncomeFunc;
    }
Ejemplo n.º 6
0
    public void Use(IFisher fisher, ISea sea, IFishing fishing)
    {
        fisher.Power++;
        Debug.Log (fisher.Power);

        if (this.onUsed != null) {
            this.onUsed.Invoke (this);
        }
    }
Ejemplo n.º 7
0
    public void Load(ISea sea, string param)
    {
        /*this.Sea = sea;

        string [] parameters = param.Split (new char[]{ '@' });

        this.horizontalSpeed = float.Parse(parameters [0]);
        this.verticalSpeed = float.Parse(parameters [1]);
        */
    }
Ejemplo n.º 8
0
    public void Init(IFishing fishing, ISea sea, IFisher fisher, Action method = null)
    {
        this.fishing = fishing;
        this.sea = sea;
        this.fisher = fisher;

        this.totalObjectForDestroying = this.sea.CountOfCatchableObjects;

        this.sea.OnDestroyCatchableObject += Foo;
    }
Ejemplo n.º 9
0
    public void Init(IFishing fishing, ISea sea, IFisher fisher, Action method = null)
    {
        this.fishing = fishing;
        this.sea = sea;
        this.fisher = fisher;

        this.fishAmount.Add ("BW Fish", 1);
        this.fishAmount.Add ("Yellow Fish", 2);
        this.fishAmount.Add ("Blue Fish", 1);

        this.sea.OnDestroyCatchableObject += Foo;
    }
Ejemplo n.º 10
0
    public void Init(ISea sea)
    {
        this.sea = sea;

        if (this.moveDirection == MoveDirection.Random) {
            this.moveDirection = (Random.Range (0, 2) == 0) ? MoveDirection.Up : MoveDirection.Down;
        }

        if (this.initLook == InitialLook.Up && this.moveDirection == MoveDirection.Down ||
            this.initLook == InitialLook.Down && this.moveDirection == MoveDirection.Up) {
            this.transform.Rotate(new Vector3(0, 0, 180));
        }
    }
    public SimpleSurpriseBottleBehaviour(ICatchable obj)
    {
        this.catchable = obj;
        this.obj = obj.GameObject.transform;
        this.sea = obj.Sea;
        //this.speed = obj.GameObject.GetComponent<SurpriseBottle>().speed;

        this.moveDirection = (UnityEngine.Random.Range (0, 2) == 1 ? MoveDirection.Right : MoveDirection.Left);

        if (this.moveDirection == MoveDirection.Left) {
            this.obj.transform.Rotate (new Vector3 (0, 180, 0));
        }
    }
Ejemplo n.º 12
0
    public void Init(ISea sea)
    {
        this.sea = sea;

        if (this.moveDirection == MoveDirection.Random) {
            this.moveDirection = (Random.Range (0, 2) == 0) ? MoveDirection.Left : MoveDirection.Right;
        }

        if (this.initLook != InitialLook.Right && this.initLook != InitialLook.Left) {
            this.initLook = InitialLook.None;
        }

        if (this.initLook == InitialLook.Right && this.moveDirection == MoveDirection.Left ||
            this.initLook == InitialLook.Left && this.moveDirection == MoveDirection.Right) {
            this.transform.Rotate(new Vector3(0, 180, 0));
        }
    }
Ejemplo n.º 13
0
    public void Load(ISea sea, string param)
    {
        this.Sea = sea;

        string [] parameters = param.Split (new char [] { '@' });
        /*
        int initLook = int.Parse (parameters [0]);

        if (initLook == 0) {
            this.initialLook = InitialLook.None;
        } else if (initLook == 1) {
            this.initialLook = InitialLook.Left;
        } else {
            this.initialLook = InitialLook.Right;
        }
        */

        this.objectName = parameters [0];
        this.weight = float.Parse (parameters [1], System.Globalization.NumberStyles.Any);
        this.price = int.Parse (parameters [2]);
    }
Ejemplo n.º 14
0
 public void Load(ISea sea, string param = "")
 {
     this.Sea = sea;
 }
Ejemplo n.º 15
0
 public void Load(ISea sea, string param = "")
 {
     this.Sea = sea;
     //this.SetAction(this.DefaultAction);	// Поскольку море не знает об объекте, устанавливаем поведение по-умолчанию сами, в последствии море уже будет само контролировать поведение
 }
Ejemplo n.º 16
0
 public SimpleLevelLoader(ISea sea)
 {
     this.sea = sea;
 }
Ejemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        this.sea = this.seaGameObject.GetComponent<ISea>();

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

        this.fisher = this.fisherGameObject.GetComponent<IFisher>();

        this.fisher.ClearState();

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

        this.fisher.Boat.OnPutStaff += (ICatchable obj) =>
        {
            this.earned += obj.Price;
            this.earnedInCurrentLevel += obj.Price;

            if (this.onEarnedUpdate != null)
            {
                this.onEarnedUpdate.Invoke(this.earned);
            }

        };

        this.timer = this.timerGameObject.GetComponent<ITimer>();

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

        this.timer.OnTimerStart += (float time) =>
        {
            this.levelTimeRemainded = time;

            if (this.onChangeLevelTime != null)
            {
                this.onChangeLevelTime.Invoke(time);
            }
        };

        this.timer.OnTimerEnd += (float time) =>
        {
            this.levelTimeRemainded = 0;

            if (this.onChangeLevelTime != null)
            {
                this.onChangeLevelTime.Invoke(time);
            }

            this.FinishLevel();
        };

        this.timer.OnTimerBeep += (float time) =>
        {
            this.levelTimeRemainded = this.levelTimeAmount - time;

            if (this.onChangeLevelTime != null)
            {
                this.onChangeLevelTime.Invoke(this.levelTimeRemainded);
            }
        };

        this.levelLoader = new SimpleLevelLoader (this.sea);

        this.IfConditionPassedStartNextLevel();
    }
Ejemplo n.º 18
0
 public void Init(ISea sea)
 {
 }