コード例 #1
0
        public NamedFilter(string name, string nonLocalizedName)
        {
            this.name             = name;
            this.nonLocalizedName = nonLocalizedName;

            // Note that we use both names in the upid.  This allows us to
            // recreate the filters at level load time even though we don't
            // have the actors yet.
            upid  = "filter.named." + name + "." + nonLocalizedName;
            label = name;

            description = CardSpace.Localize("filter.named") + " " + name;

            // NamedFilters are not read from CardSpace.xml, so we must assign initialize these fields manually.
            icon       = "image_missing";
            group      = "group.named";
            helpGroups = new string[] { "objects", "bots" };
            groupObj   = CardSpace.Cards.GetGroup(group);

            XmlInputs.Add(SensorOutputType.ActorSet);

            XmlNegOutputs.Add(SensorOutputType.TerrainMaterial);
            XmlNegOutputs.Add(SensorOutputType.WaterMaterial);
            XmlNegOutputs.Add(SensorOutputType.TouchButton);
            XmlNegOutputs.Add(SensorOutputType.Real);

            XmlCategories.Add(BrainCategories.NamedFilter);

            XmlInclusions.Add(BrainCategories.ExplicitSubject);

            XmlExclusions.Add(BrainCategories.ObjectFilter);

            OnLoad();
        }   // end of c'tor
コード例 #2
0
    public void RegenerateCardsspace(bool forceReset = false)
    {
        if (this.CardSpaceContainer == null)
        {
            return;
        }
        // deal with existing data
        var existing_cardspaces = this.CardSpaceContainer.GetComponentsInChildren <CardSpace>();

        if (!forceReset && existing_cardspaces.Count() > 0)
        {
            this.CardSpaces = new CardSpace[existing_cardspaces.Max(cs => cs.positionInBox.x) + 1, existing_cardspaces.Max(cs => cs.positionInBox.y) + 1];
            foreach (var existing_cardspace in existing_cardspaces)
            {
                existing_cardspace.Box = this;
                this.CardSpaces[existing_cardspace.positionInBox.x, existing_cardspace.positionInBox.y] = existing_cardspace;
            }
            return;
        }

        float pixerperunit      = Board.Instance.BoardCanvas.referencePixelsPerUnit;
        float canvascardheight  = this.BoxSO.CardSpaceHeight * pixerperunit;
        float canvascardhlength = this.BoxSO.CardSpaceLength * pixerperunit;

#if UNITY_EDITOR
        foreach (Transform child in this.CardSpaceContainer)
        {
            UnityEditor.EditorApplication.delayCall += () =>
            {
                GameObject.DestroyImmediate(child.gameObject);
            };
        }
#endif

        this.CardSpaces = new CardSpace[this.BoxSO.CardSpaceLength, this.BoxSO.CardSpaceHeight];

        /*for (int i = 0; i < this.BoxSO.CardSpaceLength; i++)
         * {
         *  for (int j = 0; j < this.BoxSO.CardSpaceHeight; j++)
         *  {
         *      this.CardSpaces[i, j] = new CardSpace();
         *      this.CardSpaces[i, j].Card = new Card(this.BoxSO.Cards[i, j]);
         *  }
         * }*/

        for (int k = 0; k < this.BoxSO.CardSpaceLength; k++)
        {
            for (int l = 0; l < this.BoxSO.CardSpaceHeight; l++)
            {
                CardSpace cardspace = GameObject.Instantiate <CardSpace>(this.CardSpacePrefab, this.CardSpaceContainer);
                float     x         = (k * (canvascardhlength / (float)this.BoxSO.CardSpaceLength)) + (canvascardhlength * 0.5f / (float)this.BoxSO.CardSpaceLength);
                float     y         = ((this.BoxSO.CardSpaceHeight - l - 1) * (canvascardheight / (float)this.BoxSO.CardSpaceHeight)) + (canvascardheight * 0.5f / (float)this.BoxSO.CardSpaceHeight);
                cardspace.transform.localPosition = new Vector3(x, y, 0);
                cardspace.Box           = this;
                cardspace.positionInBox = new Vector2Int(k, l);
                this.CardSpaces[k, l]   = cardspace;
            }
        }
    }
コード例 #3
0
    public void RegisterCardSpace(CardSpace cardspace)
    {
        this.CardSpace = cardspace;

        if (this.CardSpace != null)
        {
            this.CardSpace.RegisterCard(this);
        }
    }
コード例 #4
0
    public void UnregisterCardSpace()
    {
        //if we deregister the cardspace, the, also deregister the card from cardspace
        if (this.CardSpace != null)
        {
            this.CardSpace.UnregisterCard();
        }

        this.CardSpace = null;
    }
コード例 #5
0
    public int GetCardSpaceRow(CardSpace cardSpace)
    {
        int row = -1;

        for (int i = 0; i < this.CardSpaces.GetLength(0); i++)
        {
            for (int j = 0; j < this.CardSpaces.GetLength(1); j++)
            {
                if (cardSpace == this.CardSpaces[i, j])
                {
                    row = j;
                }
            }
        }

        return(row);
    }
コード例 #6
0
    public int GetCardSpaceColumn(CardSpace cardSpace)
    {
        int column = -1;

        for (int i = 0; i < this.CardSpaces.GetLength(0); i++)
        {
            for (int j = 0; j < this.CardSpaces.GetLength(1); j++)
            {
                if (cardSpace == this.CardSpaces[i, j])
                {
                    column = i;
                }
            }
        }

        return(column);
    }
コード例 #7
0
ファイル: CardSpace.cs プロジェクト: LorenzoGnech/Triangles
    void Start()
    {
        string prefix = "Spazio_";
        string n      = this.name;

        id = int.Parse(n.Replace(prefix, ""));
        bool up = this.tag == "spazio_up";

        if (up)
        {
            int left   = id - 1;
            int right  = id + 1;
            int bottom = id + 13;
            if (left != 0 && left != 26)
            {
                Cleft = GameObject.Find(prefix + left).GetComponent <CardSpace>();
            }
            if (right != 14 && right != 40)
            {
                Cright = GameObject.Find(prefix + right).GetComponent <CardSpace>();
            }
            if (bottom < 52)
            {
                Cbase = GameObject.Find(prefix + bottom).GetComponent <CardSpace>();
            }
        }
        else
        {
            int left   = id + 1;
            int right  = id - 1;
            int bottom = id - 13;
            if (left != 27 && left != 53)
            {
                Cleft = GameObject.Find(prefix + left).GetComponent <CardSpace>();
            }
            if (right != 13 && right != 39)
            {
                Cright = GameObject.Find(prefix + right).GetComponent <CardSpace>();
            }
            if (bottom > 0)
            {
                Cbase = GameObject.Find(prefix + bottom).GetComponent <CardSpace>();
            }
        }
    }
コード例 #8
0
 public CardSpaceNavigationEventData(Train train, CardSpace cardSpace, Hand viaHand)
 {
     Train     = train;
     CardSpace = cardSpace;
     ViaHand   = viaHand;
 }
コード例 #9
0
        private void SetupBoard()
        {
            List <Space> spaces = new List <Space>();

            PropertyGroup brown  = new PropertyGroup("Brown", true, 50);
            Property      medAve = new Property("Mediterranean Avenue", 60, new int[] { 2, 10, 30, 90, 160, 250 }, brown);
            Property      baltic = new Property("Baltic Avenue", 60, new int[] { 4, 20, 60, 180, 320, 450 }, brown);

            PropertyGroup railroads = new PropertyGroup("Railroads");
            Property      reading   = new Railroad("Reading Railroad", 200, 25, railroads);
            Property      penn      = new Railroad("Pennsylvania Railroad", 200, 25, railroads);
            Property      bAndO     = new Railroad("B&O Railroad", 200, 25, railroads);
            Property      shortLine = new Railroad("Short Line", 200, 25, railroads);

            PropertyGroup lightBlue = new PropertyGroup("Light Blue", true, 50);
            Property      oriental  = new Property("Oriental Avenue", 100, new int[] { 6, 30, 90, 270, 400, 550 }, lightBlue);
            Property      vermont   = new Property("Vermont Avenue", 100, new int[] { 6, 30, 90, 270, 400, 550 }, lightBlue);
            Property      conn      = new Property("Connecticut Avenue", 120, new int[] { 8, 40, 100, 300, 450, 600 }, lightBlue);

            PropertyGroup pink     = new PropertyGroup("Pink", true, 100);
            Property      stChuck  = new Property("St. Charles Place", 140, new int[] { 10, 50, 150, 450, 625, 750 }, pink);
            Property      states   = new Property("States Avenue", 140, new int[] { 10, 50, 150, 450, 625, 750 }, pink);
            Property      virginia = new Property("Virginia Avenue", 160, new int[] { 12, 60, 180, 500, 700, 900 }, pink);

            PropertyGroup utilities = new PropertyGroup("Utilities");
            Property      electric  = new Utility("Electric Company", 150, 0, utilities);
            Property      water     = new Utility("Water Works", 150, 0, utilities);

            PropertyGroup orange  = new PropertyGroup("Orange", true, 100);
            Property      stJames = new Property("St. James Place", 180, new int[] { 14, 70, 200, 550, 750, 950 }, orange);
            Property      tenn    = new Property("Tennessee Avenue", 180, new int[] { 14, 70, 200, 550, 750, 950 }, orange);
            Property      newYork = new Property("New York Avenue", 200, new int[] { 16, 80, 220, 600, 800, 1000 }, orange);

            PropertyGroup red      = new PropertyGroup("Red", true, 150);
            Property      ky       = new Property("Kentucky Avenue", 220, new int[] { 18, 90, 250, 700, 875, 1050 }, red);
            Property      indiana  = new Property("Indiana Avenue", 220, new int[] { 18, 90, 250, 700, 875, 1050 }, red);
            Property      illinois = new Property("Illinois Avenue", 240, new int[] { 20, 100, 300, 750, 925, 1100 }, red);

            PropertyGroup yellow   = new PropertyGroup("Yellow", true, 150);
            Property      atlantic = new Property("Atlantic Avenue", 260, new int[] { 22, 110, 330, 800, 975, 1150 }, yellow);
            Property      ventnor  = new Property("Ventnor Avenue", 260, new int[] { 22, 110, 330, 800, 975, 1150 }, yellow);
            Property      marv     = new Property("Marvin Gardens", 280, new int[] { 24, 120, 360, 850, 1025, 1200 }, yellow);

            PropertyGroup green    = new PropertyGroup("Green", true, 200);
            Property      pacific  = new Property("Pacific Avenue", 300, new int[] { 26, 130, 390, 900, 1100, 1275 }, green);
            Property      carolina = new Property("North Carolina Avenue", 300, new int[] { 26, 130, 390, 900, 1100, 1275 }, green);
            Property      pennAve  = new Property("Pennsylvania Avenue", 320, new int[] { 28, 150, 450, 1000, 1200, 1400 }, green);

            PropertyGroup blue      = new PropertyGroup("Blue", true, 200);
            Property      parkPlace = new Property("Park Place", 350, new int[] { 35, 175, 500, 1100, 1300, 1500 }, blue);
            Property      boardwalk = new Property("Boardwalk", 400, new int[] { 50, 200, 600, 1400, 1700, 2000 }, blue);

            Space chance    = new CardSpace("Chance", DeckFactory.Chance());
            Space commChest = new CardSpace("Community Chest", DeckFactory.CommunityChest());

            spaces = new List <Space> {
                new Go(), medAve, commChest, baltic, new IncomeTax(), reading, oriental, chance, vermont, conn,
                new Jail(), stChuck, electric, states, virginia, penn, stJames, commChest, tenn, newYork,
                new FreeParking(), ky, chance, indiana, illinois, bAndO, atlantic, ventnor, water, marv, new Spaces.GoToJail(),
                pacific, carolina, commChest, pennAve, shortLine, chance, parkPlace, new LuxuryTax(), boardwalk
            };

            foreach (Space space in spaces)
            {
                AddSpace(space);
            }
        }
コード例 #10
0
 void Awake()
 {
     cardSpace = GetComponent <CardSpace>();
 }
コード例 #11
0
ファイル: Manager.cs プロジェクト: LorenzoGnech/Triangles
    public void execute(Card attacker)
    {
        CardSpace cSpace = attacker.transform.parent.GetComponent <CardSpace>();

        cSpace.executeAttack();
    }