コード例 #1
0
ファイル: PreyLogic.cs プロジェクト: StasPeriphery/Game_Live
        public void moveFrom(Coordinate from, Coordinate to, Ocean ocean, Cell cell)
        {
            Prey prey = cell as Prey;

            if (prey == null)
            {
                return;
            }

            Cell tmp = ocean.getCellAt(from);

            if (tmp.Image == (char)ValueOcean.Fish)
            {
                ocean[to._y, to._x]     = new Prey(to, prey._timeToReproduce);
                ocean[from._y, from._x] = null;
            }
        }
コード例 #2
0
        public void moveFrom(Coordinate from, Coordinate to, Ocean ocean, Cell cell)
        {
            Predator pred = cell as Predator;

            if (pred == null)
            {
                return;
            }

            Cell tmp = ocean.getCellAt(from);

            if (tmp.Image == (char)ValueOcean.Fish)
            {
                ocean[to._y, to._x]     = new Predator(to, pred._timeToFeed);
                ocean[from._y, from._x] = null;

                pred._timeToFeed = Predator.TIME_TO_FEED; //todo what is this MTF
            }
            else
            {
                ocean[to._y, to._x]     = new Predator(to, pred._timeToFeed);
                ocean[from._y, from._x] = null;
            }
        }