コード例 #1
0
        public void OnPostUploadField([FromBody] List <List <Coordinate> > JSON)
        {
            validateUser();
            PlayerField myField = new PlayerField();

            myField.fieldNumber = StaticResources.user.orderNumber;

            foreach (List <Coordinate> coordinatesList in JSON)
            {
                List <ICoordinate> coordinates = coordinatesList.Cast <ICoordinate>().ToList();

                IBoat boat = new Boat();
                boat.FillWithCoordinates(coordinates);

                myField.AddNewBoatToField(boat);
            }

            StaticResources.field = myField;

            StaticResources.user.ready = true;

            MessageSender sender = new MessageSender();

            sender.SendReadyUpMessage();
        }
コード例 #2
0
        public void MovePawn(Point next)
        {
            if (!CanMove(next))
            {
                return;
            }

            if (IsItem(next))
            {
                MyEventStream.Instance.Push(new ItemCollectedEvent());
                if (!StillContainsItem())
                {
                    MyEventStream.Instance.Push(new AllItemsCollectedEvent());
                }
            }

            this[Pawn.Location] = new EmptyField()
            {
                Location = Pawn.Location
            };
            Pawn = new PlayerField()
            {
                Location = next
            };
            this[next] = Pawn;
            MyEventStream.Instance.Push(new PawnMovedEvent());
        }
コード例 #3
0
 void RemoveListeners(PlayerField <ICardInstance> field)
 {
     field.Hand.Changed        -= HandChanged;
     field.DrawPile.Changed    -= DeckChanged;
     field.DiscardPile.Changed -= DiscardChanged;
     field.RemovePile.Changed  -= RemovedChanged;
 }
コード例 #4
0
        public void SendSurrenderMessage()
        {
            PlayerField field = new PlayerField()
            {
                fieldNumber = StaticResources.field.fieldNumber,
                hitList     = StaticResources.field.hitList
            };

            foreach (IBoat boat in StaticResources.field.boats)
            {
                field.AddNewBoatToField(boat);
            }

            SurrenderResponse response = new SurrenderResponse()
            {
                playerId = StaticResources.user.PlayerId,
                field    = field
            };

            var indented = Formatting.Indented;
            var settings = new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.All
            };

            string line = JsonConvert.SerializeObject(response, indented, settings);

            ServiceBusHandler.program.topic.SendTopicMessage(line, MessageType.Surrender);
        }
コード例 #5
0
 void Display(PlayerField <ICardInstance> field)
 {
     _hand.Display(field.Hand);
     _draw.Display(field.DrawPile);
     _discard.Display(field.DiscardPile);
     _removed.Display(field.RemovePile);
 }
コード例 #6
0
ファイル: StatsRow.cs プロジェクト: Geraff/BehaviorIsManaged
 public StatsRow(CharacterBaseCharacteristic characteristic, PlayerField field)
 {
     if (characteristic == null) throw new ArgumentNullException("characteristic");
     Base = characteristic.@base;
     Equipements = characteristic.objectsAndMountBonus;
     AlignBonus = characteristic.alignGiftBonus;
     Context = characteristic.contextModif;
     Field = field;
 }
コード例 #7
0
 public StatsRow(CharacterBaseCharacteristic characteristic, PlayerField field)
 {
     if (characteristic == null) throw new ArgumentNullException("characteristic");
     Base = characteristic.@base;
     Equipements = characteristic.objectsAndMountBonus;
     AlignBonus = characteristic.alignGiftBonus;
     Context = characteristic.contextModif;
     Field = field;
 }
コード例 #8
0
 public GameWindow()
 {
     InitializeComponent();
     playerField   = new PlayerField(playerFieldArea.Width, playerFieldArea.Height);
     computerField = new ComputerField(computerFieldArea.Width, computerFieldArea.Height);
     computer      = new ComputerPlayer(playerField);
     DrawPlayerField();
     DrawComputerField();
 }
コード例 #9
0
        private Field[,] SetDataToPlayGround(string[] rawData)
        {
            int rows    = int.Parse(rawData[1]);
            int columns = int.Parse(rawData[0]);

            Field[,] playground = new Field[columns, rows];

            for (int line = 2; line < rows + 2; line++)
            {
                for (int sign = 0; sign < columns; sign++)
                {
                    Field field = new EmptyField()
                    {
                        Location = new System.Drawing.Point(sign, line - 2)
                    };
                    switch (rawData[line].Substring(sign, 1))
                    {
                    case CommonConstants.POINT: field = new ItemField()
                    {
                            Location = new System.Drawing.Point(sign, line - 2)
                    };
                        break;

                    case CommonConstants.ITEM_SIGN:
                        field = new ItemField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;

                    case CommonConstants.PAWN:
                        field = new PlayerField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;

                    case CommonConstants.WALL:
                        field = new WallField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;

                    default:
                        field = new EmptyField()
                        {
                            Location = new System.Drawing.Point(sign, line - 2)
                        };
                        break;
                    }
                    playground[sign, line - 2] = field;
                }
            }
            return(playground);
        }
コード例 #10
0
    // get colliders of all ships on game field
    List <Collider> GetShipColliders(PlayerField field)
    {
        List <Collider> allColl = new List <Collider>();

        foreach (Transform shi in field.transform)
        {
            allColl.AddRange(shi.GetComponentsInChildren <Collider>());
        }
        return(allColl);
    }
コード例 #11
0
        public Graphics(uint x, uint y)
        {
            Window = new RenderWindow(new VideoMode(x, y), "dsfdf");
            Window.SetVerticalSyncEnabled(true);
            Window.Closed += (obj, e) => { Window.Close(); };

            _groups = new List <Group>();

            Window.Resized += (obj, e) =>
            {
                FloatRect visibleArea = new FloatRect(0, 0, e.Width, e.Height);
                Window.SetView(new View(visibleArea));
                Window.Clear(Color.Cyan);
            };
            Window.MouseButtonPressed += (sender, args) =>
            {
                if (args.Button != Mouse.Button.Left)
                {
                    return;
                }
                foreach (var t in _groups)
                {
                    Message message = new Message();
                    message.Dict      = new Dictionary <string, int>();
                    message.Dict["X"] = args.X;
                    message.Dict["Y"] = args.Y;
                    t.Notify(EventType.Press, message);
                }
            };
            Window.MouseButtonReleased += (sender, args) =>
            {
                if (args.Button != Mouse.Button.Left)
                {
                    return;
                }
                foreach (var t in _groups)
                {
                    Message message = new Message();
                    message.Dict      = new Dictionary <string, int>();
                    message.Dict["X"] = args.X;
                    message.Dict["Y"] = args.Y;
                    t.Notify(EventType.Release, message);
                }
            };
            Window.KeyPressed += (sender, args) =>
            {
                switch (args.Code)
                {
                case Keyboard.Key.F:
                    PlayerField.GetGame().StartGame(9);
                    break;
                }
            };
            Window.MouseMoved += (sender, args) => { MousePosition = new Vector2f(args.X, args.Y); };
        }
コード例 #12
0
    public static void Load()
    {
        if (!File.Exists(savePath))
        {
            return;
        }

        string       line;
        StreamReader file = new StreamReader(savePath);

        while ((line = file.ReadLine()) != null)
        {
            string[] exp = line.Split(';');

            if (exp[0] == "gold")
            {
                PlayerCoin.Set(int.Parse(exp[1]));
            }
            else if (exp[0] == "monster")
            {
                PlayerMonster.Add(exp[1], int.Parse(exp[2]));
            }
            else if (exp[0] == "item")
            {
                PlayerItems.Add(exp[1], int.Parse(exp[2]));
            }
            else if (exp[0] == "field")
            {
                if (exp[2] == "0")
                {
                    PlayerField.Add(int.Parse(exp[1]), FieldStatus.FIELD_FAILED);
                }
                else if (exp[2] == "1")
                {
                    PlayerField.Add(int.Parse(exp[1]), FieldStatus.FIELD_1STAR);
                }
                else if (exp[2] == "2")
                {
                    PlayerField.Add(int.Parse(exp[1]), FieldStatus.FIELD_2STAR);
                }
                else if (exp[2] == "3")
                {
                    PlayerField.Add(int.Parse(exp[1]), FieldStatus.FIELD_3STAR);
                }
                else
                {
                    PlayerField.Add(int.Parse(exp[1]), FieldStatus.FIELD_EMPTY);
                }
            }

            PlayerMonster.Load();
        }

        file.Close();
    }
コード例 #13
0
ファイル: WorldObject.cs プロジェクト: BetaScripts/BotFarm
 public uint this[PlayerField index]
 {
     get
     {
         return this[(int)index];
     }
     set
     {
         this[(int)index] = value;
     }
 }
コード例 #14
0
ファイル: WorldObject.cs プロジェクト: tom1997/BotFarm
 public uint this[PlayerField index]
 {
     get
     {
         return(this[(int)index]);
     }
     set
     {
         this[(int)index] = value;
     }
 }
コード例 #15
0
 public int this[PlayerField name]
 {
     get
     {
         int value;
         return Fields.TryGetValue(name, out value) ? value : default(int);
     }
     set
     {
         if (!Fields.ContainsKey(name))
             Fields.Add(name, value);
         else
             Fields[name] = value;
     }
 }
コード例 #16
0
    public static void Save()
    {
        StreamWriter file = new StreamWriter(savePath);

        file.WriteLine("gold;" + PlayerCoin.Get());

        for (int i = 0; i < PlayerMonster.Count; i++)
        {
            file.WriteLine("monster;" + PlayerMonster.Get(i).monsterName + ";" + PlayerMonster.Get(i).exp);
        }

        foreach (KeyValuePair <string, int> pair in PlayerItems.Items)
        {
            file.WriteLine("item;" + pair.Key + ";" + pair.Value);
        }

        for (int i = 0; PlayerField.Has(i); i++)
        {
            switch (PlayerField.Get(i))
            {
            case FieldStatus.FIELD_EMPTY:
                file.WriteLine("field;" + i.ToString() + ";-1");
                break;

            case FieldStatus.FIELD_FAILED:
                file.WriteLine("field;" + i.ToString() + ";0");
                break;

            case FieldStatus.FIELD_1STAR:
                file.WriteLine("field;" + i.ToString() + ";1");
                break;

            case FieldStatus.FIELD_2STAR:
                file.WriteLine("field;" + i.ToString() + ";2");
                break;

            case FieldStatus.FIELD_3STAR:
                file.WriteLine("field;" + i.ToString() + ";3");
                break;
            }
        }

        file.Close();
    }
コード例 #17
0
 public int this[PlayerField name]
 {
     get
     {
         int value;
         return(Fields.TryGetValue(name, out value) ? value : default(int));
     }
     set
     {
         if (!Fields.ContainsKey(name))
         {
             Fields.Add(name, value);
         }
         else
         {
             Fields[name] = value;
         }
     }
 }
コード例 #18
0
 public StatsRow this[PlayerField name]
 {
     get
     {
         StatsRow value;
         return(Fields.TryGetValue(name, out value) ? value : null);
     }
     set
     {
         if (!Fields.ContainsKey(name))
         {
             Fields.Add(name, value);
         }
         else
         {
             Fields[name] = value;
         }
     }
 }
コード例 #19
0
    // check place for in field and don't touch other ships
    bool CheckShipCell(GameObject ship, PlayerField playerField)
    {
        Collider[] cols = ship.GetComponentsInChildren <Collider>();

        foreach (Collider chi in cols)
        {
            Vector3 chiRelative = playerField.transform.InverseTransformPoint(chi.transform.position);
            if (chiRelative.x < 0 || chiRelative.x > 9 || chiRelative.z > 0 || chiRelative.z < -9)
            {
                return(false);
            }

            foreach (Collider othership in otherShipColliders)
            {
                if (chi != othership && chi.transform.parent.gameObject != othership.transform.parent.gameObject &&
                    (
                        chi.transform.position == othership.transform.position ||
                        chi.transform.position + Vector3.up == othership.transform.position ||
                        chi.transform.position + Vector3.down == othership.transform.position ||
                        chi.transform.position + Vector3.forward == othership.transform.position ||
                        chi.transform.position + Vector3.back == othership.transform.position ||
                        chi.transform.position + Vector3.right == othership.transform.position ||
                        chi.transform.position + Vector3.left == othership.transform.position ||
                        chi.transform.position + Vector3.left + Vector3.up == othership.transform.position ||
                        chi.transform.position + Vector3.left + Vector3.down == othership.transform.position ||
                        chi.transform.position + Vector3.right + Vector3.up == othership.transform.position ||
                        chi.transform.position + Vector3.right + Vector3.down == othership.transform.position ||
                        chi.transform.position + Vector3.left + Vector3.forward == othership.transform.position ||
                        chi.transform.position + Vector3.left + Vector3.back == othership.transform.position ||
                        chi.transform.position + Vector3.right + Vector3.forward == othership.transform.position ||
                        chi.transform.position + Vector3.right + Vector3.back == othership.transform.position
                    )
                    )
                {
                    return(false);
                }
            }
        }
        return(true);
    }
コード例 #20
0
    void Awake()
    {
        Data          = GameObject.Find("Data(Clone)");
        DataScript    = Data.GetComponent <Data>();
        Player1_Class = DataScript.GetPlayer1P();
        Player2_Class = DataScript.GetPlayer2P();
        ExitText.text = " ";
        ExitImage     = GameObject.Find("ExitImage");
        ExitImage.SetActive(false);
        KeyButton.SetActive(false);

        Player1_BackGround_Script = Player1_BackGround.GetComponent <PlayerField>();
        Player2_BackGround_Script = Player2_BackGround.GetComponent <PlayerField>();
        Player1_BackGround_Script.SetSkill_1(Skill1P_1);
        Player1_BackGround_Script.SetSkill_2(Skill1P_2);
        Player1_BackGround_Script.SetSkill_3(Skill1P_3);
        Player2_BackGround_Script.SetSkill_1(Skill2P_1);
        Player2_BackGround_Script.SetSkill_2(Skill2P_2);
        Player2_BackGround_Script.SetSkill_3(Skill2P_3);

        Player1_BackGround_Script.SetObject(-1, Player1_Class, Player, enemy, HP);
        Player2_BackGround_Script.SetObject(1, Player2_Class, Player, enemy, HP);
    }
コード例 #21
0
    private void Awake()
    {
        _slotPrefab = Resources.Load <GameObject>("PlayerField");

        if (!(_slotPrefab is null))
        {
            _slotIsNull = false;
        }

        _controller = GetComponentInParent <PopupController>();

        if (!(_controller is null))
        {
            _controllerIsNull = false;
        }

        _playerField = GetComponent <PlayerField>();

        if (!(_playerField is null))
        {
            _fieldIsNull = false;
        }
    }
コード例 #22
0
    private void ShowGameEnd()
    {
        if (!messageBox.activeSelf)
        {
            int bonusMin = (PlayerMonster.IndexEnemy + 1) * 9;
            int bonusMax = (PlayerMonster.IndexEnemy + 1) * 12;

            if (playerHealth <= 0)
            {
                bonusMin = (PlayerMonster.IndexEnemy + 1) * 1;
                bonusMax = (PlayerMonster.IndexEnemy + 1) * 3;
            }

            int goldBonus = Random.Range(bonusMin, bonusMax);

            PlayerCoin.Add(goldBonus);
            GameObject gold = messageBox.transform.FindChild("GoldDisplay").gameObject;
            gold.GetComponent <TextMesh>().text = "+" + goldBonus;

            // Apply database
            foreach (GameObject go in activeMonster)
            {
                PlayerMonster.Get(go.GetComponent <Monster>().StorageIndex).exp =
                    go.GetComponent <Monster>().Exp;
            }

            List <GameObject> dropItem = new List <GameObject>();
            foreach (GameObject item in Reference.Asset.itemTemplate)
            {
                int rand = Random.Range(0, 100);

                if (rand <= item.GetComponent <Item>().DropWeight)
                {
                    PlayerItems.Add(item.name, 1);
                    dropItem.Add(item);
                }
            }

            int count = 0;
            foreach (GameObject go in dropItem)
            {
                GameObject item = (GameObject)Instantiate(go,
                                                          new Vector3(count, 0, 0),
                                                          Quaternion.identity);
                item.GetComponent <SpriteRenderer>().sortingOrder = 2;
                count++;
            }

            switch (defeatedEnemy)
            {
            case 0:
                if (PlayerField.Get(PlayerMonster.IndexEnemy) != FieldStatus.FIELD_3STAR &&
                    PlayerField.Get(PlayerMonster.IndexEnemy) != FieldStatus.FIELD_2STAR &&
                    PlayerField.Get(PlayerMonster.IndexEnemy) != FieldStatus.FIELD_1STAR)
                {
                    PlayerField.Add(PlayerMonster.IndexEnemy, FieldStatus.FIELD_FAILED);
                }
                break;

            case 1:
                if (PlayerField.Get(PlayerMonster.IndexEnemy) != FieldStatus.FIELD_3STAR &&
                    PlayerField.Get(PlayerMonster.IndexEnemy) != FieldStatus.FIELD_2STAR)
                {
                    PlayerField.Add(PlayerMonster.IndexEnemy, FieldStatus.FIELD_1STAR);
                }
                break;

            case 2:
                if (PlayerField.Get(PlayerMonster.IndexEnemy) != FieldStatus.FIELD_3STAR)
                {
                    PlayerField.Add(PlayerMonster.IndexEnemy, FieldStatus.FIELD_2STAR);
                }
                break;

            case 3:
                PlayerField.Add(PlayerMonster.IndexEnemy, FieldStatus.FIELD_3STAR);
                break;
            }

            messageBox.SetActive(true);
        }

        GameObject title = messageBox.transform.FindChild("TextHelper").gameObject;

        if (playerHealth > 0)
        {
            title.GetComponent <TextMesh>().text  = "Victory";
            title.GetComponent <TextMesh>().color = new Color(255, 226, 0);
        }
        else
        {
            title.GetComponent <TextMesh>().text  = "Defeated";
            title.GetComponent <TextMesh>().color = new Color(233, 0, 0);
        }
    }
コード例 #23
0
 public ComputerPlayer(PlayerField playerField)
 {
     this.playerField = playerField;
     ChooseRandomCell();
 }
コード例 #24
0
 internal StatsRow(CharacterBaseCharacteristic characteristic, PlayerField field, Action<StatsRow> onChanged)
 {
     m_onChanged = onChanged;
 }
コード例 #25
0
        public Goban(GoRulesBase rulesBase)
        {
            _rulesBase    = rulesBase;
            _grid         = new GameObject[rulesBase[0], rulesBase[0]];
            _scoreObjects = new TextObject[2];
            Vector2u   windowSize = PlayerField.GetGame().MainFrame.Window.Size;
            GameObject back       = new GameObject(new RectangleShape((Vector2f)windowSize));

            back.Shape.FillColor = Color.Blue;
            AddShape(back);
            int        minDimension = (int)Math.Min(windowSize.X, windowSize.Y);
            int        offset       = minDimension / 20;
            int        placeSize    = minDimension - offset;
            GameObject place        = new GameObject(new RectangleShape(new Vector2f(placeSize, placeSize)));

            place.Subscribe = new NotifierSub(place);

            place.Subscribe.AddObserver(new OnPressMessage(((i, i1) =>
            {
                if (!rulesBase.GetActivePerson().IsBot&& !rulesBase.IsFinished)
                {
                    int id = rulesBase.GetActivePerson().Id - 1;
                    Console.WriteLine(id.ToString());
                    _selectedStone = new Stone(_cubeSize / 3f);
                    Color customColor = new Color();
                    customColor.A = 255;
                    customColor.R = (byte)(255 * id);
                    customColor.G = (byte)(255 * id);
                    customColor.B = (byte)(255 * id);
                    _selectedStone.Shape.FillColor = customColor;
                    _selectedStone.ChangeState(new GrabedState(_selectedStone));
                    _selectedStone.Update();
                    AddShape(_selectedStone);
                }
            })));

            place.Subscribe.AddObserver(new OnReleaseMessage(((x, y) =>
            {
                if (!rulesBase.GetActivePerson().IsBot)
                {
                    if (_selectedStone != null)
                    {
                        (bool canPlace, int xStone, int yStone) = CanTookStone(x, y);
                        bool isStepDone = rulesBase.GetActivePerson().MakeStep(xStone, yStone);
                        if (isStepDone)
                        {
                            _selectedStone.ChangeState(null);
                            TookOnGrid(_selectedStone, xStone, yStone);
                            CheckConfirmity();
                        }
                        else
                        {
                            RemoveShape(_selectedStone);
                        }
                        _selectedStone = null;
                    }
                }
            })));

            AddShape(place);
            place.Shape.Position  = new Vector2f(offset / 2.0f, offset / 2.0f);
            place.Shape.FillColor = Color.Green;

            int size = rulesBase[0];

            _cubeSize   = (float)placeSize / size;
            _rectOffset = offset / 2.0f + _cubeSize / 2;
            for (int i = 0; i < size; i++)
            {
                RectangleShape lineHorizontal = new RectangleShape(new Vector2f(placeSize - _cubeSize, 1));
                lineHorizontal.FillColor = Color.Black;
                lineHorizontal.Position  = new Vector2f(_rectOffset, _rectOffset + _cubeSize * i);
                AddShape(new GameObject(lineHorizontal));

                RectangleShape lineVertical = new RectangleShape(new Vector2f(1, placeSize - _cubeSize));
                lineVertical.FillColor = Color.Black;
                lineVertical.Position  = new Vector2f(_rectOffset + _cubeSize * i, _rectOffset);
                AddShape(new GameObject(lineVertical));
            }


            _scoreObjects[0] = new TextObject("Score: 0", new Font("C:/CurrentProjects/LetsGo/Game/FONT.ttf"));
            _scoreObjects[0].Text.FillColor = Color.Black;
            _scoreObjects[1] = new TextObject("Score: 0", new Font("C:/CurrentProjects/LetsGo/Game/FONT.ttf"));
            _scoreObjects[1].Text.FillColor = Color.White;
            Vector2f textSize = new Vector2f(_scoreObjects[0].Text.GetGlobalBounds().Width,
                                             _scoreObjects[0].Text.GetGlobalBounds().Height + 20);

            _scoreObjects[0].Text.Position = (Vector2f)PlayerField.GetGame().MainFrame.Window.Size - textSize;

            textSize = new Vector2f(_scoreObjects[1].Text.GetGlobalBounds().Width,
                                    _scoreObjects[1].Text.GetGlobalBounds().Height);
            _scoreObjects[1].Text.Position =
                new Vector2f((PlayerField.GetGame().MainFrame.Window.Size.X - textSize.X), 0);
            AddShape(_scoreObjects[0]);
            AddShape(_scoreObjects[1]);



            TextObject passText = new TextObject("Pass", new Font("C:/CurrentProjects/LetsGo/Game/FONT.ttf"));
            GameObject pass     = new GameObject(new RectangleShape(new Vector2f(
                                                                        passText.Text.GetGlobalBounds().Width * 1.5f, passText.Text.GetGlobalBounds().Height * 1.5f)));

            //ButtonObject Pass = new ButtonObject("Pass", new Font("C:/CurrentProjects/LetsGo/Game/FONT.ttf"));
            pass.Shape.Position     = new Vector2f(650, 300);
            passText.Text.Position  = new Vector2f(650, 300);
            passText.Text.FillColor = Color.Magenta;
            pass.Subscribe          = new NotifierSub(pass);
            pass.Subscribe.AddObserver(new OnPressMessage(((i, i1) =>
            {
                if (!rulesBase.GetActivePerson().IsBot)
                {
                    ((Player)rulesBase.GetActivePerson()).Pass();
                }

                if (rulesBase.IsFinished)
                {
                    string endText;
                    if (rulesBase.Persons[0].Score < rulesBase.Persons[1].Score)
                    {
                        endText = "WHITE WIN";
                    }
                    else if (rulesBase.Persons[0].Score > rulesBase.Persons[1].Score)
                    {
                        endText = "BLACK WIN";
                    }
                    else
                    {
                        endText = "DRAW";
                    }
                    TextObject finishText = new TextObject(endText, new Font("C:/CurrentProjects/LetsGo/Game/FONT.ttf"));
                    finishText.Text.Position = new Vector2f(250, 250);
                    finishText.Text.FillColor = Color.Blue;

                    AddShape(finishText);
                }
                pass.Shape.FillColor = Color.Green;
            })));
            pass.Subscribe.AddObserver(new OnReleaseMessage(((i, i1) => { pass.Shape.FillColor = Color.White; })));
            AddShape(pass);
            AddShape(passText);
        }
コード例 #26
0
ファイル: StatsRow.cs プロジェクト: a3gis/BehaviorIsManaged
 internal StatsRow(CharacterBaseCharacteristic characteristic, PlayerField field, Action<StatsRow> onChanged)
 {
     m_onChanged = onChanged;
 }
コード例 #27
0
ファイル: StatsRow.cs プロジェクト: a3gis/BehaviorIsManaged
 internal StatsRow(PlayerField field, Action<StatsRow> onChanged)
     : this(field)
 {
     m_onChanged = onChanged;
 }
コード例 #28
0
ファイル: StatsRow.cs プロジェクト: a3gis/BehaviorIsManaged
 public StatsRow(PlayerField field)
 {
     Field = field;
 }
コード例 #29
0
 public override void UpdateState()
 {
     Obj.Shape.Position = PlayerField.GetGame().MainFrame.MousePosition;
 }
コード例 #30
0
 public override void Update()
 {
     PlayerField.GetGame().MainFrame.Window.Draw(Text);
 }
コード例 #31
0
 internal StatsRow(PlayerField field, Action<StatsRow> onChanged)
     : this(field)
 {
     m_onChanged = onChanged;
 }
コード例 #32
0
ファイル: Dummy.cs プロジェクト: Jack-Mutsers/battleship_view
        public PlayerField GetMyDummyField()
        {
            int         field   = StaticResources.user.orderNumber;
            PlayerField myField = new PlayerField()
            {
                fieldNumber = field,
            };

            List <List <ICoordinate> > CoordinateList = new List <List <ICoordinate> >()
            {
                new List <ICoordinate>()
                {
                    new Coordinate()
                    {
                        field = field, row = 1, col = 1
                    }, new Coordinate()
                    {
                        field = field, row = 1, col = 2
                    }, new Coordinate()
                    {
                        field = field, row = 1, col = 3
                    }, new Coordinate()
                    {
                        field = field, row = 1, col = 4
                    }, new Coordinate()
                    {
                        field = field, row = 1, col = 5
                    }
                },
                new List <ICoordinate>()
                {
                    new Coordinate()
                    {
                        field = field, row = 4, col = 9
                    }, new Coordinate()
                    {
                        field = field, row = 5, col = 9
                    }, new Coordinate()
                    {
                        field = field, row = 6, col = 9
                    }, new Coordinate()
                    {
                        field = field, row = 7, col = 9
                    }
                },
                new List <ICoordinate>()
                {
                    new Coordinate()
                    {
                        field = field, row = 7, col = 4
                    }, new Coordinate()
                    {
                        field = field, row = 7, col = 5
                    }, new Coordinate()
                    {
                        field = field, row = 7, col = 6
                    }
                },
                new List <ICoordinate>()
                {
                    new Coordinate()
                    {
                        field = field, row = 9, col = 7
                    }, new Coordinate()
                    {
                        field = field, row = 9, col = 8
                    }, new Coordinate()
                    {
                        field = field, row = 9, col = 9
                    }
                },
                new List <ICoordinate>()
                {
                    new Coordinate()
                    {
                        field = field, row = 3, col = 4
                    }, new Coordinate()
                    {
                        field = field, row = 4, col = 4
                    }
                },
            };

            foreach (List <ICoordinate> coordinates in CoordinateList)
            {
                IBoat boat = new Boat();
                boat.FillWithCoordinates(coordinates);

                myField.AddNewBoatToField(boat);
            }

            return(myField);
        }
コード例 #33
0
 public StatsRow this[PlayerField name]
 {
     get
     {
         StatsRow value;
         return Fields.TryGetValue(name, out value) ? value : null;
     }
     set
     {
         if (!Fields.ContainsKey(name))
             Fields.Add(name, value);
         else
             Fields[name] = value;
     }
 }
コード例 #34
0
 private void Awake()
 {
     _deck        = _deckSo.CreateInstance();
     _playerField = new PlayerField <ICardInstance>();
     _playerField.Reset(_deck);
 }
コード例 #35
0
    // Use this for initialization
    void Start()
    {
        List <GameObject> templates = Reference.Asset.monsterTemplate;
        Vector3           offset    = new Vector3(0, 3f);

        bool empty = false;

        for (int i = 0; i < templates.Count - 2; i++)
        {
            GameObject go = null;

            if (i % 2 == 0)
            {
                go = (GameObject)Instantiate(areaDot,
                                             new Vector3(-2, -i, 0) + offset,
                                             Quaternion.identity);
            }
            else
            {
                go = (GameObject)Instantiate(areaDot,
                                             new Vector3(2, -i, 0) + offset,
                                             Quaternion.identity);
            }

            go.transform.localScale = new Vector3(0.7f, 0.7f);
            go.transform.parent     = this.transform;

            if (empty)
            {
                go.GetComponent <SpriteRenderer>().color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
            }

            FieldStatus fs = PlayerField.Get(i);
            switch (fs)
            {
            case FieldStatus.FIELD_EMPTY:
                if (!empty)
                {
                    fs = FieldStatus.FIELD_FAILED;
                }
                empty = true;
                break;

            case FieldStatus.FIELD_FAILED:
                Instantiate(starFailedTemplate,
                            go.transform.position + new Vector3(0, 0.75f),
                            Quaternion.identity);
                break;

            case FieldStatus.FIELD_1STAR:
                Instantiate(star1Template,
                            go.transform.position + new Vector3(0, 0.75f),
                            Quaternion.identity);
                break;

            case FieldStatus.FIELD_2STAR:
                Instantiate(star2Template,
                            go.transform.position + new Vector3(0, 0.75f),
                            Quaternion.identity);
                break;

            case FieldStatus.FIELD_3STAR:
                Instantiate(star3Template,
                            go.transform.position + new Vector3(0, 0.75f),
                            Quaternion.identity);
                break;
            }

            fieldStats.Add(fs);
            areaList.Add(go);

            GameObject collider = (GameObject)Instantiate(colliderTemplate,
                                                          go.transform.position,
                                                          Quaternion.identity);
            collider.transform.parent = this.transform;
            colliderList.Add(collider);
        }

        // Generate path
        for (int i = 0; i < areaList.Count - 1; i++)
        {
            GameObject from      = areaList[i];
            GameObject to        = areaList[i + 1];
            Vector3    direction = to.transform.position - from.transform.position;

            for (int j = 2; j < 11; j++)
            {
                float      randomVar    = 0.2f * Mathf.Sin(Mathf.PI * (j + 2) / 10);
                Vector3    randomOffset = new Vector3(randomVar, -randomVar);
                GameObject go           = (GameObject)Instantiate(connectorDot,
                                                                  from.transform.position + (direction.normalized * j) / 3 + randomOffset,
                                                                  Quaternion.identity);
                go.transform.parent = this.transform;
            }
        }
    }
コード例 #36
0
 public StatsRow(PlayerField field)
 {
     Field = field;
 }