Exemple #1
0
 private void Awake()
 {
     // Find all scripts of type Player and store them in Players array.
     Players = GameObject.FindObjectsOfType <Player>();
     // Obtain unique ID from IDFactory
     playerID = IDFactory.GetUniqueID();
 }
Exemple #2
0
    // CONSTRUCTOR
    public CardLogic(CardAsset ca)
    {
        // ustaw referencje CardAsset
        /// NA PRZYSZŁOŚć: this - odwołanie się klasy samej do siebie, Dlaczego tutaj tak? Bo parametrem funkcji jest ca więc odwołujemy się do niego
        this.ca = ca;

        //zdobądz unikalny int ID
        // Do UniqueCardID przypisujemy wynik pobrany z funkcji GetUniqueID, która znajduje się w klasie IDFactory
        UniqueCardID = IDFactory.GetUniqueID();
        //UniqueCardID = IDFactory.GetUniqueID();

        ResetManaCost(); // Wywołujemy funkcję ResetManaCost()

        //Tworzymy instancję SpellEffect z nazwą z CardAsset i dołączamy ją
        // Sprawdzamy czy zmienna SpellScriptName nie jest pusta i przechowuje jakąś nazwę skryptu
        if (ca.SpellScriptName != null && ca.SpellScriptName != "")
        {
            // Tworzymy instancję aktywatora (pobiera typ(nazwę skryptu czaru)) nadaje mu typ spelleffect
            /// NA przyszłosc: getType sprawdza również duże i małe litery
            effect = System.Activator.CreateInstance(System.Type.GetType(ca.SpellScriptName)) as SpellEffect;
        }
        //Dodaj tę kartę do magazynu z identyfikatorem jako klucz
        // Odwołuje się do tablicy CardsCreatedThisGame i dodaje kartę (add) z jej identyfikatorem i assetem, który przechowywany jest w ca (odwołanie this)
        CardsCreatedThisGame.Add(UniqueCardID, this);
    }
Exemple #3
0
    public ArmyCardsModel()
    {
        this.deckCardList = new List <Card>();

        // Generate deck for an army
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Artyleria")));
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Janczar")));
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Kazasker")));
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Sulejman")));

        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Artyleria")));
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Janczar")));
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Kazasker")));
        deckCardList.Add(Instantiate(Resources.Load <Card>("Cards/Sulejman")));

        // assign unique id for each card in deck
        foreach (Card item in deckCardList)
        {
            item.cardID = IDFactory.GetUniqueID();
        }

        this.handCardList      = new List <Card>();
        this.frontCardList     = new List <Card>();
        this.graveyardCardList = new List <Card>();
    }
Exemple #4
0
 // WSZYSTKIE METODY
 void Awake()
 {
     // znajdź wszystkie skrypty typu Player i zapisz je w tablicy Players
     // (powinno być tylko 2 graczy na scenie)
     Players = GameObject.FindObjectsOfType <Player>();
     // uzyskaj unikalny identyfikator od IDFactory
     PlayerID = IDFactory.GetUniqueID();
 }
Exemple #5
0
    public CreatureLogic(Player owner, CardAsset cardAsset)
    {
        ID    = IDFactory.GetUniqueID();
        Owner = owner;
        CreaturesCreatedThisGame.Add(ID, this);

        LoadCreatureStatusFromCardAsset(owner, cardAsset);
    }
Exemple #6
0
 // ALL METHODS
 void Awake()
 {
     // find all scripts of type Player and store them in Players array
     // (we should have only 2 players in the scene)
     Players = GameObject.FindObjectsOfType <Player>();
     // obtain unique id from IDFactory
     PlayerID = IDFactory.GetUniqueID();
 }
Exemple #7
0
    public CardLogic(Player owner, CardAsset cardAsset)
    {
        ID        = IDFactory.GetUniqueID();
        Owner     = owner;
        CardAsset = cardAsset;
        CardsCreatedThisGame.Add(ID, this);

        LoadCardLogicFromCardAsset(cardAsset);
    }
Exemple #8
0
 // ALL METHODS
 void Awake()
 {
     Instance = this;
     // find all scripts of type Player and store them in Players array
     // (we should have only 2 players in the scene)
     //Players = GameObject.FindObjectsOfType<Player>();
     // obtain unique id from IDFactory
     PlayerID = IDFactory.GetUniqueID();
     deck     = GameManager.Instance.ItemDeck();
     hand     = new Hand();
 }
 public CreatureLogic(Player owner, CardAsset cardAsset)
 {
     this.owner       = owner;
     this.cardAsset   = cardAsset;
     uniqueCreatureID = IDFactory.GetUniqueID();
     if (cardAsset.creatureScriptName != null && cardAsset.creatureScriptName != "")
     {
         effect = System.Activator.CreateInstance(System.Type.GetType(cardAsset.creatureScriptName), new System.Object[] { owner, this, cardAsset.specialCreatureAmount }) as CreatureEffect;
         // effect.RegisterEventEffect();
     }
     creaturesCreatedThisGame.Add(uniqueCreatureID, this);
 }
Exemple #10
0
 public CardLogic(CardAsset ca)
 {
     this.ca      = ca;
     UniqueCardID = IDFactory.GetUniqueID();
     baseManaCost = ca.ManaCost;
     ResetManaCost();
     if (ca.SpellScriptName != null && ca.SpellScriptName != "")
     {
         effect = System.Activator.CreateInstance(System.Type.GetType(ca.SpellScriptName)) as SpellEffect;
     }
     CardsCreatedThisGame.Add(UniqueCardID, this);
 }
Exemple #11
0
    public CardLogic(ScriptableObject ca)
    {
        this.ca      = ca;
        UniqueCardID = IDFactory.GetUniqueID();

        /* TODO
         * if (ca.SpellScriptName!= null && ca.SpellScriptName!= "")
         * {
         * effect = System.Activator.CreateInstance(System.Type.GetType(ca.SpellScriptName)) as SpellEffect;
         * }
         */
        CardsCreatedThisGame.Add(UniqueCardID, this);
    }
Exemple #12
0
    public CardLogic(AdventureAsset newCardAsset)
    {
        this.ca = newCardAsset;

        if (newCardAsset.Description == "F O E")
        {
            string stage1 = newCardAsset.CharacterPower.Split(' ') [0];
            string stage2 = stage1.Split('/') [0];
            characterPower = int.Parse(stage2);
        }
        UniqueCardID = IDFactory.GetUniqueID();
        CardsCreatedThisTime.Add(UniqueCardID, this);
    }
Exemple #13
0
 public CardLogic(CardAsset ca, Player owner)
 {
     this.owner   = owner;
     this.ca      = ca;
     UniqueCardID = IDFactory.GetUniqueID();
     ResetManaCost();
     if (!string.IsNullOrEmpty(ca.SpellScriptName))
     {
         effect = System.Activator.CreateInstance(System.Type.GetType(ca.SpellScriptName)) as SpellEffect;
         if (effect != null)
         {
             effect.owner = owner;
         }
     }
     CardsCreatedThisGame.Add(UniqueCardID, this);
 }
Exemple #14
0
    //constructor
    public SoldierLogic(Player owner, CardAsset ca)
    {
        this.ca           = ca;
        baseHealth        = ca.MaxHealth;
        health            = ca.MaxHealth;
        baseAttack        = ca.Attack;
        attacksForOneTurn = ca.AttacksForOneTurn;
        if (ca.Charge)
        {
            AttacksLeftThisTurn = attacksForOneTurn;
        }
        this.owner      = owner;
        UniqueSoldierID = IDFactory.GetUniqueID();

        SoldiersCreatedThisGame.Add(UniqueSoldierID, this);
    }
Exemple #15
0
    // ALL METHODS
    void Awake()
    {
        // find all scripts of type Player and store them in Players array
        // (we should have only 2 players in the scene)
        Players = GameObject.FindObjectsOfType <Player>();
        // obtain unique id from IDFactory
        PlayerID = IDFactory.GetUniqueID();
        //Debug.Log(PArea.owner);
        PlayerManagement.iniDeck();
        if (PArea.owner == AreaPosition.Low)
        {
            deck.cards = PlayerManagement.getCard();
        }

        //Debug.Log(deck.cards.Count);
    }
Exemple #16
0
    public void ResetDeck()
    {
        cards = new List <CardAsset>();
        IDFactory.ResetIDs();

        foreach (var ca in cardCollection.cards)
        {
            for (int i = 0; i < ca.NumberInDeck; i++)
            {
                CardAsset card = Object.Instantiate(ca);
                card.Id = IDFactory.GetUniqueID();
                cards.Add(card);
            }
        }

        cards.Shuffle();
    }
 // CONSTRUCTOR
 public CardLogic(CardAsset ca)
 {
     // set the CardAsset reference
     this.ca = ca;
     // get unique int ID
     UniqueCardID = IDFactory.GetUniqueID();
     //UniqueCardID = IDFactory.GetUniqueID();
     ResetManaCost();
     // create an instance of SpellEffect with a name from our CardAsset
     // and attach it to
     if (ca.SpellScriptName != null && ca.SpellScriptName != "")
     {
         effect = System.Activator.CreateInstance(System.Type.GetType(ca.SpellScriptName)) as SpellEffect;
     }
     // add this card to a dictionary with its ID as a key
     CardsCreatedThisGame.Add(UniqueCardID, this);
 }
Exemple #18
0
    // CONSTRUCTOR
    public CardLogic(CardAsset cardAsset, Player owner)
    {
        this.owner     = owner;
        this.cardAsset = cardAsset;
        uniqueCardID   = IDFactory.GetUniqueID();
        SetManaCost();

        // Create an instance of SpellEffect with a name from our CardAsset and attach it to this cards effect.
        if (cardAsset.spellScriptName != null && cardAsset.spellScriptName != "")
        {
            effect = System.Activator.CreateInstance(System.Type.GetType(cardAsset.spellScriptName)) as SpellEffect;
        }

        SetSpawnTiles();

        // TODO: Add this card to a dictionary with its ID as a key.
        cardsCreatedThisGame.Add(uniqueCardID, this);
    }
Exemple #19
0
    // ALL METHODS
    void Awake()
    {
        // find all scripts of type Player and store them in Players array
        // (we should have only 2 players in the scene)
        Players = GameObject.FindObjectsOfType <Player>();
        // obtain unique id from IDFactory
        PlayerID = IDFactory.GetUniqueID();

        if (deck == null)
        {
            deck = GameObject.Find("DeckLogic").GetComponent <Deck>();
            deck.cards.Shuffle();
        }

        if (charAsset == null)
        {
            CharAssetLogic charAssetLogic = GameObject.Find("CharLogic").GetComponent <CharAssetLogic>();
            charAsset = charAssetLogic.playerChar;
        }
    }
Exemple #20
0
 public CreatureLogic(Player owner, CardAsset ca)
 {
     this.ca           = ca;
     baseHealth        = ca.MaxHealth;
     Health            = ca.MaxHealth;
     baseAttack        = ca.Attack;
     attacksForOneTurn = ca.AttacksForOneTurn;
     if (ca.Charge)
     {
         AttacksLeftThisTurn = attacksForOneTurn;
     }
     this.owner       = owner;
     UniqueCreatureID = IDFactory.GetUniqueID();
     if (ca.CreatureScriptName != null && ca.CreatureScriptName != "")
     {
         effect = System.Activator.CreateInstance(System.Type.GetType(ca.CreatureScriptName), new System.Object[] { owner, this, ca.specialCreatureAmount }) as CreatureEffect;
         effect.RegisterEffect();
     }
     CreaturesCreatedThisGame.Add(UniqueCreatureID, this);
 }
    // Make Dictionary<int, Tile> tilesByID

    // Use this for initialization
    public void TableSetup()
    {
        _width     = GlobalSettings.instance.maxWidth;
        _height    = GlobalSettings.instance.maxHeight;
        tableTiles = new Tile[_width, _height];

        Tile[] tiles = tableVisual.transform.GetComponentsInChildren <Tile>();

        for (int i = 0; i < tiles.Length; i++)
        {
            tableTiles[tiles[i].x, tiles[i].y] = tiles[i];

            // Add ID to all table tiles
            int currentID = IDFactory.GetUniqueID();
            tableTiles[tiles[i].x, tiles[i].y].gameObject.AddComponent <IDHolder>().uniqueID = currentID;

            // Add the Tile GameObject to the tableVisual data
            tableVisual.tileGameObjectsByID.Add(currentID, tableTiles[tiles[i].x, tiles[i].y].gameObject);
        }

        GeneratePathFindingGraph();
    }
    public CreatureLogic(Player owner, CardAsset ca)
    {
        this.ca            = ca;
        _baseHealth        = ca.MaxHealth;
        Health             = ca.MaxHealth;
        _baseAttack        = ca.Attack;
        _attacksForOneTurn = ca.AttacksForOneTurn;

        if (ca.Charge)
        {
            AttacksLeftThisTurn = _attacksForOneTurn;
        }

        Taunt            = ca.Taunt;
        this.owner       = owner;
        UniqueCreatureID = IDFactory.GetUniqueID();
        if (!string.IsNullOrEmpty(ca.CreatureScriptName))
        {
            effect = System.Activator.CreateInstance(System.Type.GetType(ca.CreatureScriptName), new System.Object[] { owner, this, ca.SpecialCreatureAmount }) as CreatureEffect;
            effect.RegisterEventEffect();
        }
        CreaturesCreatedThisGame.Add(UniqueCreatureID, this);
    }
Exemple #23
0
 void Awake()
 {
     Players  = GameObject.FindObjectsOfType <Player>();
     PlayerID = IDFactory.GetUniqueID();
 }
Exemple #24
0
	void Awake(){
		Instance = this;
		Players = GameObject.FindObjectsOfType<Player> ();
		PlayerID = IDFactory.GetUniqueID ();
        source = GameObject.Find("DrawSource");
	}