Ejemplo n.º 1
0
    public void SetMaterial(int[] temp)
    {
        Material[] mats = PC.Instance.characterMaterialMesh.renderer.materials;
        GameObject cc   = GameObject.FindWithTag("CharColor");

        if (cc != null)
        {
            CharacterAsset ca = cc.GetComponent <CharacterAsset>();
            if (ca != null)
            {
                Debug.Log("Find Asset Manager");
                mats[0] = ca.feetMaterial[temp[0]];
                mats[1] = ca.legMaterial[temp[1]];
                mats[2] = ca.handsMaterial[temp[2]];
                mats[3] = ca.torsoMaterial[temp[3]];
                mats[4] = ca.faceMaterial[temp[4]];

                PC.Instance.characterMaterialMesh.renderer.materials = mats;
            }
            else
            {
                Debug.Log("No Asset Manager");
            }
        }
    }
Ejemplo n.º 2
0
        public override CharacterCore Create(CharacterAsset asset, Transform anchor)
        {
            var go = Container.InstantiatePrefab(
                Prefab,
                anchor.position,
                anchor.rotation,
                null);

            go.name = asset.name;
            var enemy = Container.InstantiateComponent <EnemyCore>(go);

//				character._weaponAnchor = character.transform.Find(WeaponBindAnchor);
            enemy.ThemeColor   = asset.ThemeColor;
            enemy.CharacterRig = enemy.GetComponent <Rigidbody>();

            enemy.OnSpawn(asset);
//				var weapon = WeaponRanged.Create(weaponAsset.Weapon, anchor);
            var arm = enemy.GetComponent <CharacterArm>();

            arm.Core = enemy;
            arm.Attach(WeaponFactory.Create(_weaponAsset, anchor));


//				character.AttachWeapon(weapon);

            return(enemy);
        }
Ejemplo n.º 3
0
 public DeckInfo(List <CardAsset> cards, string deckName, CharacterAsset charAsset)
 {
     // copy a list, not just use the cards list
     Cards     = new List <CardAsset>(cards);
     Character = charAsset;
     DeckName  = deckName;
 }
Ejemplo n.º 4
0
 public void OnScreenBecameActive()
 {
     if (loadOnScreenBecameActive && loadActiveCharacter)
     {
         Load(CharacterAsset.GetTachieBundleId(Context.CharacterManager.SelectedCharacterId));
     }
 }
Ejemplo n.º 5
0
        public void Add(
            PlayerSession player,
            CharacterAsset characterResource)
        {
            Platform platform = _platformTemplate.Create(
                _platformsParent.transform.position + Vector3.right * _platforms.Count * PlatformOffset,
                _platformsParent.transform,
                player);

            platform.OnPlatformFinishedHandler += OnPlatformFinished;
            _platforms.Add(platform);
            _timer.OnTimeLimitHandler += platform.OnTransitionToTimeOut;

            Character character =
                characterResource.Create(
                    platform._characterAnchor.transform.position,
                    platform._characterAnchor.transform);

            _characters.Add(character);
            character.transform.rotation = platform._visual.Parent.transform.rotation;
            platform.Character           = character;

            character.ColorId = player.ServerId;
            character.Color   = player.Color;
        }
Ejemplo n.º 6
0
        private void Wear_Add(int pos, string model)
        {
            replace[pos] = false;

            if (!string.IsNullOrEmpty(model))
            {
                bool doo   = false;
                int  index = CharacterAsset.TryNameToID(model);
                if (index >= 0)
                {
                    CharacterAsset ca = assetArr[pos];
                    if (ca != null)
                    {
                        if (index != ca.id)
                        {
                            doo = true;
                        }
                    }
                    else
                    {
                        doo = true;
                    }
                }
                else
                {
                    doo = true;
                }

                if (doo)
                {
                    replace[pos] = true;
                }
            }
        }
Ejemplo n.º 7
0
    public void LoadFromNetworkPlayer(NetworkPlayer np)
    {
        this.np            = np;
        nickname           = np.nickname;
        nicknameField.text = nickname;

        avatarAsset         = np.avatar;
        avatarSprite.sprite = avatarAsset.AvatarImage;

        if (!np.cardsPlayed.Any() || np.cardsPlayed.Count < 2)
        {
            Debug.LogError("ERROR:  Loading PlayedItem.cs from Player who didn't play any cards.");
        }
        else
        {
            card1Asset = np.cardsPlayed[0].ca;
            card2Asset = np.cardsPlayed[1].ca;

            OneCardManager card1Manager = card1.GetComponent <OneCardManager>();
            card1Manager.cardAsset = card1Asset;
            card1Manager.ReadCardFromAsset();
            OneCardManager card2Manager = card2.GetComponent <OneCardManager>();
            card2Manager.cardAsset = card2Asset;
            card2Manager.ReadCardFromAsset();
        }
    }
Ejemplo n.º 8
0
    void SetActive(bool isActive)
    {
        if (CharacterAsset == null)
        {
            return;
        }

        if (isActive == true)
        {
            Character character = CharacterAsset.Alloc();
            CoreUtility.SetRecursiveLayer(character.gameObject, "Character");
            character.transform.SetParent(transform, false);
            character.transform.localPosition = Vector3.zero;
            character.IsPause = false;

            character.CharacterAnimation.SetBattleMode();
            character.SetUIMode(false);
            character.CharacterAnimation.SetRenderQueue(2999);
        }
        else if (CharacterAsset != null && CharacterAsset.Asset != null)
        {
            //m_PlaybackTime = Character.PlaybackTime;
            Character.Reset();
            CharacterAsset.Asset.Creature = null;
            CharacterAsset.Free();
        }
    }
Ejemplo n.º 9
0
        public override CharacterCore Create(CharacterAsset asset, Transform anchor)
        {
            var go = Container.InstantiatePrefab(Prefab);
            var tf = go.transform;

            tf.position = anchor.position;
            tf.rotation = anchor.rotation;

            Debug.Log($"{tf.position}{tf.rotation}");

            go.name = asset.name;

//				var character = go.AddComponent<T>();
            var player = Container.InstantiateComponent <PlayerCore>(go);


//				character._weaponAnchor = character.transform.Find(WeaponBindAnchor);
            player.ThemeColor   = asset.ThemeColor;
            player.CharacterRig = player.GetComponent <Rigidbody>();
            player.OnSpawn(asset);

            var arm = player.GetComponent <CharacterArm>();

            arm.Core = player;
            arm.Attach(WeaponFactory.Create(_weaponAsset, anchor));

            return(player);
        }
Ejemplo n.º 10
0
        public void Init(
            CharacterAsset asset,
            RenderTexture renderTexture,
            float horizontalOffset
            )
        {
            _characterAsset       = asset;
            _renderTexture        = renderTexture;
            _camera.targetTexture = _renderTexture;

            transform.localPosition = Vector3.right * horizontalOffset;

            _character = asset.Create(
                transform.position,
                _anchor,
                Quaternion.identity);
            _character.Transform.rotation =
                Quaternion.LookRotation(
                    Vector3.forward,
                    Vector3.up);
            _character.FSM_SetState(
                World.Objects
                .ObjectState
                .CharacterSelect);

            UpdateCamera();
        }
        private CharacterElement CreateCharacterGUI(VisualElement root, CharacterAsset asset, CharacterRow character)
        {
            var contentElems  = new List <ContentElement>();
            var characterElem = new CharacterElement {
                userData = contentElems,
                text     = character.Id.Or("<none>")
            };

            var languages      = new List <string>(asset.Languages);
            var languagesPopup = new LanguagePopup("Language Id", languages, 0);

            languagesPopup.RegisterValueChangedCallback(OnChangeLanguage);
            characterElem.Content.Add(languagesPopup);

            CreateAvatarGUI(characterElem.Content, character);
            CreateP1GUI(characterElem.Content, character);
            CreateP1BackgroundGUI(characterElem.Content, character);
            CreateP2GUI(characterElem.Content, character);
            CreateP2BackgroundGUI(characterElem.Content, character);
            CreateP3GUI(characterElem.Content, character);
            CreateP3BackgroundGUI(characterElem.Content, character);
            CreateContentGUI(characterElem.Content, asset, character, contentElems, languages[0]);

            root.Add(characterElem);
            return(characterElem);
        }
Ejemplo n.º 12
0
 public void BuildADeckFor(CharacterAsset asset)
 {
     ShowScreenForDeckBuilding();
     CollectionBrowserScript.ShowCollectionForDeckBuilding(asset);
     DeckBuildingScreen.Instance.TabsScript.SetClassOnClassTab(asset);
     BuilderScript.BuildADeckFor(asset);
 }
Ejemplo n.º 13
0
    protected override async void OnRendered()
    {
        base.OnRendered();

        toggleOfflineButton.GetComponentInChildren <Text>().text = Context.IsOnline() ? "OFFLINE_GO_OFFLINE".Get() : "OFFLINE_GO_ONLINE".Get();
        LayoutFixer.Fix(toggleOfflineButton.transform);
        profileTab.characterTransitionElement.Enter();
        profileTab.changeCharacterButton.gameObject.SetActive(LoadedPayload.IsPlayer);
        contentTabs.gameObject.SetActive(LoadedPayload.IsPlayer);
        topRightColumn.gameObject.SetActive(LoadedPayload.IsPlayer);
        // Always use local character if local player
        if (LoadedPayload.Profile.User.Uid == Context.Player.Id)
        {
            profileTab.characterDisplay.Load(CharacterAsset.GetTachieBundleId(Context.CharacterManager.SelectedCharacterId));
        }
        else if (LoadedPayload.Profile.Character != null)
        {
            profileTab.characterDisplay.Load(CharacterAsset.GetTachieBundleId(LoadedPayload.Profile.Character.AssetId));
        }
        contentTabs.Select(LoadedPayload.TabIndex);
        await UniTask.DelayFrame(2);

        if (LoadedPayload.ProfileScrollPosition > -1)
        {
            profileTab.scrollRect.verticalNormalizedPosition = LoadedPayload.ProfileScrollPosition;
        }
    }
Ejemplo n.º 14
0
    public CharacterAsset DealAvatar()
    {
        Debug.Log("Dealing avatar: " + AvatarDictionary[0].name);
        CharacterAsset newAvatar = AvatarDictionary[0];

        AvatarDictionary.RemoveAt(0);
        return(newAvatar);
    }
Ejemplo n.º 15
0
 public void loadFromPlayer(NetworkPlayer np)
 {
     this.np  = np;
     Nickname = np.nickname;
     Coins    = np.coins;
     ca       = np.avatar;
     loadVisualsFromObject();
 }
 public void SetCharacterInfo(CharacterAsset asset, int playerNumber)     //finds the character and assigns the proper texts
 {
     this.asset = asset;
     gameObject.SetActive(true);
     playerNum = playerNumber;
     charaName = asset.CharacterName;
     characterNameText.text = asset.DisplayName.ToUpper();
     StartCoroutine(WaitAndSetCharacterInfo());
 }
Ejemplo n.º 17
0
    // Use this for initialization
    void Start()
    {
        ca = GameObject.Find("Character Asset Manager").GetComponent <CharacterAsset>();

        //InstantiateCharacterModel();
        //PC.Instance = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerCharacter>();

//		InstantiateWeaponModel();
    }
Ejemplo n.º 18
0
    private void populateFields(CharacterAsset ca, string na)
    {
        characterToDisplay = ca;
        nickname           = na;

        avatar.sprite = characterToDisplay.AvatarImage;

        nicknameLabel.text = nickname;
    }
Ejemplo n.º 19
0
    // Use this for initialization
    void Start()
    {
        ca = GameObject.Find("Character Asset Manager").GetComponent <CharacterAsset>();

        InstantiateCharacterModel();
        RefreshCharacterMeshMaterials();

        InstantiateWeaponModel();
        InstantiateHairMesh();
    }
Ejemplo n.º 20
0
    void Start()
    {
        sa = GameObject.Find("_StadiumAssetManager").GetComponent <StadiumAsset>();
        ca = GameObject.Find("_CharacterAssetManager").GetComponent <CharacterAsset>();

        stadiumSelected = sa.chosenStadium.name;

        InstantiateCharacterModel();
        hasChangeScene = false;
    }
Ejemplo n.º 21
0
    private void ShowCards(bool showingCardsPlayerDoesNotOwn = false, int pageIndex         = 0, bool includeAllRarities = true, bool includeAllCharacters = true,
                           RarityOptions rarity = RarityOptions.Basic, CharacterAsset asset = null, string keyword       = "", int manaCost = -1, bool includeTokenCards = false)
    {
        // saving the information about the cards that we are showing to players on this page
        _showingCardsPlayerDoesNotOwn = showingCardsPlayerDoesNotOwn;
        _pageIndex            = pageIndex;
        _includeAllRarities   = includeAllRarities;
        _includeAllCharacters = includeAllCharacters;
        _rarity            = rarity;
        _asset             = asset;
        _keyword           = keyword;
        _manaCost          = manaCost;
        _includeTokenCards = includeTokenCards;

        List <CardAsset> CardsOnThisPage = PageSelection(showingCardsPlayerDoesNotOwn, pageIndex, includeAllRarities, includeAllCharacters, rarity,
                                                         asset, keyword, manaCost, includeTokenCards);

        // clear created cards list
        ClearCreatedCards();

        if (CardsOnThisPage.Count == 0)
        {
            return;
        }

        // Debug.Log(CardsOnThisPage.Count);

        for (int i = 0; i < CardsOnThisPage.Count; i++)
        {
            GameObject newMenuCard;

            if (CardsOnThisPage[i].TypeOfCard == TypesOfCards.Creature)
            {
                // it is a creature card
                newMenuCard = Instantiate(CreatureMenuPrefab, Slots[i].position, Quaternion.identity) as GameObject;
            }
            else
            {
                // it is a spell card
                newMenuCard = Instantiate(SpellMenuPrefab, Slots[i].position, Quaternion.identity) as GameObject;
            }

            newMenuCard.transform.SetParent(this.transform);

            CreatedCards.Add(newMenuCard);

            OneCardManager manager = newMenuCard.GetComponent <OneCardManager>();
            manager.cardAsset = CardsOnThisPage[i];
            manager.ReadCardFromAsset();

            AddCardToDeck addCardComponent = newMenuCard.GetComponent <AddCardToDeck>();
            addCardComponent.SetCardAsset(CardsOnThisPage[i]);
            addCardComponent.UpdateQuantity();
        }
    }
Ejemplo n.º 22
0
    public void ShowCollectionForDeckBuilding(CharacterAsset buildingForThisCharacter)
    {
        KeywordInputFieldScript.Clear();
        CardsThatYouDoNotHaveToggleScript.SetValue(false);
        ManaFilterSctipt.RemoveAllFilters();

        _character = buildingForThisCharacter;

        ShowCards(false, 0, true, false, RarityOptions.Basic, _character, "", -1, false);
        DeckBuildingScreen.Instance.TabsScript.ClassTab.Select(instant: true);
        DeckBuildingScreen.Instance.TabsScript.SelectTab(DeckBuildingScreen.Instance.TabsScript.ClassTab, instant: true);
    }
Ejemplo n.º 23
0
    void Awake()
    {
        // allow only one instance of the Main Menu
        if (instance != null && instance != this)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
        instance = this;
    }
Ejemplo n.º 24
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
Ejemplo n.º 25
0
    private void ChangeCardColorBasedOnCharacterAsset(CharacterAsset characterAsset)
    {
        if (CardBodyImage != null)
        {
            CardBodyImage.color = characterAsset != null ? characterAsset.ClassCardTint : Color.white;
        }

        if (RibbonImage != null)
        {
            RibbonImage.color = characterAsset != null ? characterAsset.ClassRibbonsTint : Color.white;
        }
    }
    private void populateFields(CharacterAsset ca, string na)
    {
        characterToDisplay = ca;
        nickname           = na;

        largeAvatar.sprite = characterToDisplay.AvatarImage;
        smallAvatar.sprite = characterToDisplay.AvatarImage;

        largeNickname.text = nickname;
        smallNickname.text = nickname;
        commandText.text   = "Tell us about \n yourself!";
    }
Ejemplo n.º 27
0
 public List <CardAsset> GetCardsOfCharacter(CharacterAsset asset)
 {
     /*
      * // get cards that blong to a particular character or neutral if asset == null
      * var cards = from card in allCardsArray
      *                          where card.CharacterAsset == asset
      *                          select card;
      *
      * var returnList = cards.ToList<CardAsset>();
      * returnList.Sort();
      */
     return(GetCards(true, true, false, RarityOptions.Basic, asset));
 }
Ejemplo n.º 28
0
    public void initializeAvatars()
    {
        avatarAssets = new List <CharacterAsset>();
        int numSlots = avatarSlots.Count;

        for (int i = 0; i < numSlots; i++)
        {
            CharacterAsset newAv = GameManager.Instance.avatarManager.DealAvatar();
            avatarAssets.Add(newAv);
        }

        fillSlots();
    }
    public void StartGame()
    {
        CharacterAsset[] selected = new CharacterAsset[dropDowns.Length];
        for (int i = 0; i < dropDowns.Length; i++)
        {
            selected[i] = characterAssets[dropDowns[i].value];
        }

        //Debug.Log("1: " + selected[0].name + "  / 2: " + selected[1].name + "  / 3: " + selected[2].name);

        GameManager.instance.CreateControllers(selected);
        gameObject.SetActive(false);
    }
Ejemplo n.º 30
0
 private void fillFromPlayer()
 {
     if (player.nickname == null)
     {
         PlayerName.text = "Noname";
     }
     else
     {
         PlayerName.text = player.nickname;
     }
     characterAsset   = player.avatar;
     PlayerName.color = characterAsset.PlayerTextTint;
     Avatar.sprite    = characterAsset.AvatarImage;
 }
Ejemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        ca = GameObject.Find("Character Asset Manager").GetComponent<CharacterAsset>();

        //InstantiateCharacterModel();
        //PC.Instance = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerCharacter>();

        //		InstantiateWeaponModel();
    }
Ejemplo n.º 32
0
    // Use this for initialization
    void Start()
    {
        ca = GameObject.Find("Character Asset Manager").GetComponent<CharacterAsset>();

        InstantiateCharacterModel();
        RefreshCharacterMeshMaterials();

        InstantiateWeaponModel();
        InstantiateHairMesh();
    }