Пример #1
0
 public override void OnAddedToEntity()
 {
     base.OnAddedToEntity();
     MaximumHealth        = 100;
     player               = Entity.GetComponent <PlayerComponent>().loginManager.GetCharacter();
     player.CurrentHealth = MaximumHealth;
 }
Пример #2
0
 public void Start()
 {
     _player = GameManager.GetCharacterManager().GetPlayer() as CharacterPlayer;
     //_dog = GameManager.GetCharacterManager().GetDog() as CharacterPlayer;
     // get character stats variables
     _hPText        = RootObject.transform.Find("HPValue").GetComponent <Text>();
     _levelText     = RootObject.transform.Find("LevelValue").GetComponent <Text>();
     _expText       = RootObject.transform.Find("ExpValue").GetComponent <Text>();
     _expNeededText = RootObject.transform.Find("ExpNeededValue").GetComponent <Text>();
     _pickup1Text   = RootObject.transform.Find("Pickup1Value").GetComponent <Text>();
     _pickup2Text   = RootObject.transform.Find("Pickup2Value").GetComponent <Text>();
     _pickup3Text   = RootObject.transform.Find("Pickup3Value").GetComponent <Text>();
     _pickup4Text   = RootObject.transform.Find("Pickup4Value").GetComponent <Text>();
     _attackText    = RootObject.transform.Find("AttackValue").GetComponent <Text>();
     _defendText    = RootObject.transform.Find("DefendValue").GetComponent <Text>();
     _magicDefText  = RootObject.transform.Find("MagicDefValue").GetComponent <Text>();
     _evadeText     = RootObject.transform.Find("EvadeValue").GetComponent <Text>();
     _hitText       = RootObject.transform.Find("HitValue").GetComponent <Text>();
     // get character upgrade variables
     _hPUpgradeText       = RootObject.transform.Find("HPUpgradeValue").GetComponent <Text>();
     _attackUpgradeText   = RootObject.transform.Find("AttackUpgradeValue").GetComponent <Text>();
     _defendUpgradeText   = RootObject.transform.Find("DefendUpgradeValue").GetComponent <Text>();
     _magicDefUpgradeText = RootObject.transform.Find("MagicDefUpgradeValue").GetComponent <Text>();
     _evadeUpgradeText    = RootObject.transform.Find("EvadeUpgradeValue").GetComponent <Text>();
     _hitUpgradeText      = RootObject.transform.Find("HitUpgradeValue").GetComponent <Text>();
     // get the weapon and armore text
     _weaponText = RootObject.transform.Find("SelectedWeaponText").GetComponent <Text>();
     _ArmoreText = RootObject.transform.Find("SelectedArmorText").GetComponent <Text>();
     UpdateStats();
 }
Пример #3
0
    public void UpdateTxtValueProperties()
    {
        CharacterPlayer _tempPlayer = new CharacterPlayer();

        CharacterPlayer.LoadCharacterPlayer(_tempPlayer);
        NewCharacterStatus _tempNewCharacter = new NewCharacterStatus(_tempPlayer);

        _tempNewCharacter.loadDynamicIndexToMid();
        _nameCharacterText.text = CharacterInfo._instance._baseProperties.name.ToString();
        _fightingPowerTxt.text  = CharacterInfo._instance._baseProperties.AttributePoint.ToString();
        _expText.text           = CharacterInfo._instance._baseProperties.Level.ToString();
        _vitalityTxt.text       = "" + (float)_tempNewCharacter.getMidIndex(Indexes.vit_na);
        _strengthTxt.text       = "" + (float)_tempNewCharacter.getMidIndex(Indexes.str_na);
        _intellText.text        = "" + (float)_tempNewCharacter.getMidIndex(Indexes.int_na);


        _heathText.text     = "" + (float)_tempNewCharacter.getMidIndex(Indexes.max_hp_na);
        _physicDmgText.text = "" + Mathf.RoundToInt(((float)_tempNewCharacter.getMidIndex(Indexes.min_pda_na) + (float)_tempNewCharacter.getMidIndex(Indexes.max_pda_na)) * 0.5f);
        //Debug.Log( _tempNewCharacter.getMidIndex(Indexes.min_pda_na) + " - " + _tempNewCharacter.getMidIndex(Indexes.max_pda_na));
        _physicDefText.text = "" + Mathf.RoundToInt(((float)_tempNewCharacter.getMidIndex(Indexes.min_pde_na) + (float)_tempNewCharacter.getMidIndex(Indexes.max_pde_na)) * 0.5f);
        //_tempNewCharacter.getMidIndex(Indexes.min_pde_na) + " - " + _tempNewCharacter.getMidIndex(Indexes.max_pde_na);
        _magicDmgText.text = "" + Mathf.RoundToInt(((float)_tempNewCharacter.getMidIndex(Indexes.min_mda_na) + (float)_tempNewCharacter.getMidIndex(Indexes.max_mda_na)) * 0.5f);
        // _tempNewCharacter.getMidIndex(Indexes.min_mda_na) + " - " + _tempNewCharacter.getMidIndex(Indexes.max_mda_na);
        _magicDefText.text = "" + Mathf.RoundToInt(((float)_tempNewCharacter.getMidIndex(Indexes.min_mde_na) + (float)_tempNewCharacter.getMidIndex(Indexes.max_mde_na)) * 0.5f);
        //_tempNewCharacter.getMidIndex(Indexes.min_mde_na) + " - " + _tempNewCharacter.getMidIndex(Indexes.max_mde_na);
    }
Пример #4
0
        private bool CheckIfNeedToUpdate(CharacterPlayer current, CharacterPlayer recieved)
        {
            for (int i = 0; i < current.GetInventory().Length - 1; i++)
            {
                WeaponItem existing = current.GetInventory()[i];
                WeaponItem newItem  = recieved.GetInventory()[i];

                if ((existing != null && newItem == null) || (existing == null && newItem != null))
                {
                    return(true);
                }
                if (existing != null & newItem != null && !existing.Name.Equals(newItem.Name))
                {
                    return(true);
                }
            }
            for (int i = 0; i < current.Equipment.Length - 1; i++)
            {
                EqupmentBase existing = current.GetEquipment()[i];
                EqupmentBase newItem  = recieved.GetEquipment()[i];

                if ((existing != null && newItem == null) || (existing == null && newItem != null))
                {
                    return(true);
                }
                if (existing != null & newItem != null && !existing.Name.Equals(newItem.Name))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #5
0
    public void FollowCharacter(CharacterPlayer instance)
    {
        float distance = Vector3.Distance(transform.position, CharacterPlayer.instance.transform.position);

        MoveToTargetPos(instance.transform.position);

        if (distance < EntityManager.Instance.npcCorpseDetectionDistance / 4)
        {
            CheckForCatchDistance(distance);
        }
        else if (distance < EntityManager.Instance.npcCorpseDetectionDistance / 2)
        {
            lastKnownPosition   = instance.GetPosition();
            lastKnownFleeAlley  = null;
            CurrentTaskDuration = AlarmedDuration;
            SetStatus(ENPCStatus.Alarmed);
        }
        else if (distance < EntityManager.Instance.npcCorpseDetectionDistance)
        {
            lastKnownPosition   = instance.GetPosition();
            lastKnownFleeAlley  = null;
            CurrentTaskDuration = AlarmedDuration;
            SetStatus(ENPCStatus.Alert);
        }
        else
        {
            Debug.LogError("Incosistent State: Cant follow player that is to far away.");
        }
    }
Пример #6
0
        public override void Update()
        {
            if (other != null)
            {
                other = LoginManagerClient.OtherCharacters.Find(c => c._name.Equals(other._name));
                if (other != null)
                {
                    other.MaxHealth = 100;
                    Vector2 p = Scene.Camera.WorldToScreenPoint(other.physicalPosition);
                    bar.SetPosition(p.X - bar.PreferredWidth / 2, p.Y - bar.PreferredHeight / 2);
                    if (past != other.CurrentHealth)
                    {
                        if (other.CurrentHealth > 0)
                        {
                            bar.SetValue(other.CurrentHealth / (float)other.MaxHealth);
                        }
                        else
                        {
                            bar.SetValue(0);
                        }

                        //HealthtextComponent.SetText(other.CurrentHealth.ToString());
                        past = other.CurrentHealth;
                    }
                }
            }
            base.Update();
        }
Пример #7
0
        public void Update()
        {
            //checks if client is still connected
            //CheckIfConnected();
            timeSpan += Time.DeltaTime;
            //Updates every 1/20 second
            if (timeSpan > 0.05)
            {
                if (CurrentLayer != null)
                {
                    HashSet <LoginManagerServer> characterlist = CurrentLayer.LayerLogins;

                    if (characterlist != null && characterlist.Count > 0 && loginManager != null)
                    {
                        CharacterPlayer tempc = loginManager.GetCharacter();

                        //sets the position of the entity's physical body as the physical position
                        FSRigidBody v = Core.Scene.FindEntity(tempc._name).GetComponent <FSRigidBody>();

                        tempc.physicalPosition = v.Transform.Position;

                        DataTemplate dataTemplate = new DataTemplate
                        {
                            RecieverCharacter = tempc,
                            OthersCharacters  = FillRecieverList(characterlist, tempc)
                        };
                        //makes the position relative to client's side of the map position
                        dataTemplate.RecieverCharacter.physicalPosition = dataTemplate.RecieverCharacter.physicalPosition - MapContainer.GetMapByName(CurrentLayer.MapName).Entity.Position;
                        string posString = Newtonsoft.Json.JsonConvert.SerializeObject(dataTemplate);

                        MessageManager.SendStringToUniqueID(Entity.Scene, posString, loginManager.GetUniqueID(), MessageType.GameUpdate);
                    }
                }
            }
        }
Пример #8
0
        public OtherPlayerEntity(CharacterPlayer others) : base(others._name)
        {
            others.MaxHealth = 100;

            other = others;
            TextComponent textComponent = new TextComponent(Graphics.Instance.BitmapFont, others._name, Vector2.Zero, Color.White);

            //HealthtextComponent = new TextComponent(Graphics.Instance.BitmapFont, others.CurrentHealth.ToString(), Vector2.Zero, Color.White);

            this.SetPosition(others.physicalPosition);
            AddComponent(new OtherPlayerComponent(others));
            AddComponent(textComponent);
            //AddComponent(HealthtextComponent).SetHorizontalAlign(HorizontalAlign.Left).SetVerticalAlign(VerticalAlign.Bottom).SetRenderLayer(-2);
            SetTag(7);
            this.SetScale(3.5f);

            SpriteAnimation Idle     = TextureContainer.GetSpriteAtlasByName("Knight").GetAnimation("Idle");
            SpriteAnimation Movement = TextureContainer.GetSpriteAtlasByName("Knight").GetAnimation("Movement");

            SpriteAnimator animator = AddComponent <SpriteAnimator>();

            animator.AddAnimation("Idle", Idle);
            animator.AddAnimation("Movement", Movement);
            animator.Play("Idle");
        }
Пример #9
0
        public static void DisconnectConnection(NetConnection sender, Scene scene)
        {
            NetServer server = ServerNetworkSceneComponent.GetNetServer();

            LoginManagerServer login = MapContainer.GetLoginByID(sender.RemoteUniqueIdentifier);

            if (login != null)
            {
                CharacterPlayer characterPlayer = login.GetCharacter();

                //Saves data to SQL database
                string characterString = Newtonsoft.Json.JsonConvert.SerializeObject(characterPlayer, new StringEnumConverter());
                SQLManager.UpdateToSQL(login.username, characterString);

                //removes login manager
                MapContainer.RemoveLoginByID(login.GetUniqueID());

                if (characterPlayer != null)
                {
                    //removes entity
                    CharacterManager.RemoveCharacterFromScene(scene, characterPlayer._name);
                }
            }

            //removes the connection
            sender.Disconnect("Closed");
            Console.WriteLine("Disconnected! Connected: " + ServerNetworkSceneComponent.GetNetServer().ConnectionsCount);
            MainScene.ConnectedCount.SetText("Current connections: " + server.ConnectionsCount);
        }
Пример #10
0
    // =============================================== EFFECT: REVIVE ===============================================

    private void OrbEffectRevive()
    {
        CharacterPlayer ClosestDeadPlayer         = null;
        float           ClosestDeadPlayerDistance = -1;
        float           CurrentDistance           = -2;

        for (int i = 0; i < DeadPlayerCharacters.Count; i++)
        {
            if (DeadPlayerCharacters[i].gameObject.layer == CharacterPlayer.DeadCharacterLayerID)
            {
                CurrentDistance = Vector3.Distance(transform.position, DeadPlayerCharacters[i].transform.position);

                if (CurrentDistance < ClosestDeadPlayerDistance || ClosestDeadPlayerDistance < 0)
                {
                    ClosestDeadPlayerDistance = CurrentDistance;
                    ClosestDeadPlayer         = DeadPlayerCharacters[i];
                }
            }
        }

        if (!ClosestDeadPlayer)
        {
            return;
        }

        //ClosestDeadPlayer.ChangeHealthCurrent(Mathf.Max(-1 * (HealthCurrent - 1), -1 * Mathf.RoundToInt(GetHealthMax() * RespawnHealthCostPerc)));
        ClosestDeadPlayer.RespawnThisCharacter(transform.position);
    }
Пример #11
0
    public void MeeleAttack(CharacterPlayer atk, CharacterPlayer def, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill)
    {
        Debug.Log("melee atack");
        //skeletonAnimation.AnimationName = moveAnimation;
        skeletonAnimator.Skeleton.FlipX = false;
        Vector3 oldPos = this.transform.position;
        float   newPosX;

        if (transform.position.x < def.transform.position.x)
        {
            newPosX = def.transform.position.x - def.GetComponent <BoxCollider2D>().bounds.size.x;
        }
        else
        {
            newPosX = def.transform.position.x + def.GetComponent <BoxCollider2D>().bounds.size.x;
        }
        if (CharacterManager.Instance._meCharacter == atk)
        {
            BattleSceneUI.Instance._effectParentMe.transform.DOMoveX(newPosX, 0.1f);
        }
        if (CharacterManager.Instance._enemyCharacter == atk)
        {
            BattleSceneUI.Instance._effectParentEnemy.transform.DOMoveX(newPosX, 0.1f);
        }
        transform.DOMoveX(newPosX, 0.1f).OnComplete(() => AttackandBack(atk, def, oldPos, playerId, indexState, health, isnormalAtk, useSkill));
    }
Пример #12
0
    public IEnumerator ExecuteRangeAttack(CharacterPlayer _atk, CharacterPlayer _target, Transform hostPos, Transform newPos, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill)
    {
        skeAnimator.SetBool("attack", true);
        yield return(new WaitForSeconds(0.01f));

        yield return(new WaitForSeconds(skeAnimator.GetCurrentAnimatorStateInfo(0).length / 2f - 0.01f));

        if (isnormalAtk)
        {
            GameObject bullet = EffectManager.Instance.CreateEffect("Prefabs/RangeAttack", hostPos);
            bullet.transform.position = new Vector3(hostPos.position.x + hostPos.GetComponent <BoxCollider2D>().bounds.size.x / 2, hostPos.position.y + hostPos.GetComponent <BoxCollider2D>().bounds.size.y / 2, hostPos.position.z);
            EffectManager.Instance.EffectMoving(bullet, newPos.position.x, 0.5f);
        }
        else
        {
            if (useSkill != null)
            {
                if (useSkill.data["type"].Value.ToString() == "passive")
                {
                }
                else if (useSkill.data["type"].Value.ToString() != "passive")
                {
                    GameObject effSkill = EffectManager.Instance.CreateEffect("Effect/" + useSkill.data["prefEffect"].Value.ToString(), this.transform);
                    effSkill.transform.position = new Vector3(_target.transform.position.x, _target.transform.position.y + _target.GetComponent <BoxCollider2D>().bounds.size.y / 2, _target.transform.position.z);
                }
            }
        }



        SendDamage(playerId.ToString() + "," + indexState.ToString() + "," + health.ToString() + "," + "senddamge");
        yield return(new WaitForSeconds(skeAnimator.GetCurrentAnimatorStateInfo(0).length / 2f));

        skeAnimator.SetBool("attack", false);
    }
Пример #13
0
        public void SetupTiles()
        {
            if (Core.Scene == null)
            {
                return;
            }
            MapList = FileManager.GetMapInformation("Data/" + ConstantValues.MapDataFileName);
            Map.Map         map = null;
            CharacterPlayer c   = LoginManagerClient.GetCharacter();

            foreach (var maps in MapList)
            {
                if (maps.MapName == c.LastMultiLocation)
                {
                    map = maps;
                }
            }
            if (map != null)
            {
                entity = Scene.CreateEntity(map.MapName);
                TiledMapRenderer tmr = entity.AddComponent(new TiledMapRenderer(map.TmxMap));
                tmr.Material = new Material(BlendState.NonPremultiplied);
                tmr.SetRenderLayer(1);
                tmr.SetLayersToRender(new string[] { "Tile", "Collision", "Decoration", "CustomCollision" });
                TmxObjectGroup l = map.TmxMap.GetLayer <TmxObjectGroup>("Objects");
                foreach (TmxObject obj in l.Objects)
                {
                    ObjectSceneEntity osc = new ObjectSceneEntity(obj, tmr.TiledMap.TileWidth);
                    osc.SetPosition(osc.Position);
                    Scene.AddEntity(osc);
                }
            }
        }
Пример #14
0
        private void UnEquipItem(MessageTemplate template, NetIncomingMessage message)
        {
            int index = -1;

            try
            {
                int.TryParse(template.JsonMessage, out index);
            }
            catch
            { }

            if (index != -1)
            {
                CharacterPlayer character = MapContainer.FindCharacterByID(message.SenderConnection.RemoteUniqueIdentifier);
                WeaponItem      newItem   = character.GetInventory().ElementAt(index);
                if (newItem != null)
                {
                    int        type        = (int)newItem.GetEqupmentType();
                    WeaponItem currentItem = character.Equipment[type];

                    if (currentItem == null)
                    {
                        character.Inventory[index] = null;
                    }
                    else
                    {
                        character.Inventory[index] = currentItem;
                    }

                    character.Equipment[type] = newItem;
                }
            }
        }
Пример #15
0
 public void Player_Constructor_InvalidData()
 {
     try
     {
         Character character = new CharacterPlayer(CharacterClass.Gunner, -10);
         Assert.Fail();
     } catch { }
 }
Пример #16
0
    public void RangeAttack(CharacterPlayer atk, CharacterPlayer def, int playerId, int indexState, int health, bool isnormalAtk, NewSkill useSkill)
    {
        Transform hostPos = this.transform;
        Transform newPosX;

        newPosX = def.transform;
        StartCoroutine(ExecuteRangeAttack(atk, def, hostPos, newPosX, playerId, indexState, health, isnormalAtk, useSkill));
    }
    private void PlayerClickedAnObject(GameObject clickedGameObject)
    {
        // Sanity check.
        if (clickedGameObject == null)
        {
            return;
        }

        // Check if object is on a Character.
        Character character = clickedGameObject.GetComponentInChildren <Character>();

        if (character == null)
        {
            character = clickedGameObject.GetComponentInParent <Character>();
        }
        if (character != null)
        {
            // Debug.Log( "Player clicked on a Character: " +character.name );

            // What to do when a player has clicked on a character (NOTE: Could be self!)

            // Check if it was an enemy that was clicked on.
            CharacterEnemy enemy = character as CharacterEnemy;
            if (enemy != null)
            {
                Debug.Log("Player clicked on an Enemy: " + enemy.name);
            }

            return;
        }

        // Check if object is on an Item.
        Item item = clickedGameObject.GetComponentInChildren <Item>();

        if (item == null)
        {
            item = clickedGameObject.GetComponentInParent <Item>();
        }
        if (item != null)
        {
            Debug.Log("Player clicked on an item: " + item.itemName);

            // Direct the player to head to the clicked item.
            CharacterPlayer player = GameManager.GetPlayer();
            if (player != null)
            {
                PlayerControllerARPG controller = player.GetComponent <PlayerControllerARPG>();
                if (controller != null)
                {
                    controller.SetNavMeshAgentDestination(item.transform.position);
                }
            }

            return;
        }

        Debug.Log("Player clicked on an object: " + clickedGameObject.name);
    }
Пример #18
0
    public void createNewPlayerDisplay(CharacterPlayer player)
    {
        GameObject newDisplay = Instantiate(playerDisplayPrefab);

        newDisplay.transform.parent = playerDisplayContainer;
        PlayerDisplayGUI playerDisplay = newDisplay.GetComponent <PlayerDisplayGUI>();

        playerDisplay.initDisplay(player);
    }
Пример #19
0
        public void Player_Hit_LessHealth()
        {
            Character character = new CharacterPlayer(CharacterClass.Gunner, 10);
            Bullet    b         = new Bullet(3);

            character.Hit(b);

            Assert.IsTrue(character.Health == 7);
        }
Пример #20
0
        public override void Update()
        {
            if (player != null)
            {
                player = LoginManagerClient.GetCharacter();

                HealthtextComponent.SetText(player.CurrentHealth.ToString());
            }
            base.Update();
        }
Пример #21
0
 void shufflePlayers(List <CharacterPlayer> list)
 {
     for (int i = 0; i < list.Count; i++)
     {
         int             r    = Random.Range(0, list.Count);
         CharacterPlayer temp = list[i];
         list[i] = list[r];
         list[r] = temp;
     }
 }
Пример #22
0
        private async void Update()
        {
            while (alive && MyState != MobState.Sleeping)
            {
                await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    CharacterPlayer target = null;// new CharacterPlayer(new Canvas(), new Player("000000"), new Canvas());// = GetNearestPlayer();
                    if (target == null)
                    {
                        MyState = MobState.Alert;
                    }
                    else
                    {
                        distInitialToMob = GetDistance(FirstX, FirstY, xCharacVal, yCharacVal);
                        distPlayer       = GetDistance(target.xCharacVal + MainCamera.instance.CameraXOffSet * -1, target.yCharacVal + MainCamera.instance.CameraYOffSet * -1,
                                                       xCharacVal + characT.Width / 2, FirstY + characT.Height / 2);

                        if (distInitialToMob >= MaxDistance)
                        {
                            MyState = MobState.Alert;
                        }
                        else if (distPlayer < MinDistance && distInitialToMob < MinDistance / 2)
                        {
                            if (Mob.Meek && Mob.Hp == Mob.HpMax)
                            {
                                MyState = MobState.Alert;
                            }
                            else
                            {
                                MyState = MobState.Following;
                            }
                        }
                        else if (distInitialToMob > ChunckDistance)
                        {
                            moveLeft  = false;
                            moveRight = false;
                            MyState   = MobState.Sleeping;
                        }
                    }

                    switch (MyState)
                    {
                    case MobState.Alert:
                        stats = "Alerta";
                        AlertState();
                        break;

                    case MobState.Following:
                        stats = "Seguindo";
                        FollowingState(target);
                        break;
                    }
                });
            }
        }
Пример #23
0
 public void finishLevelUp()
 {
     levelUpPanel.SetActive(false);
     currentPlayer.health.healToFull();
     currentPlayer.health.spToFull();
     currentPlayer = null;
     if (needsLevelUp.Count > 0)
     {
         levelUpCharacter(needsLevelUp.Pop());
     }
 }
Пример #24
0
        public CharacterMob(Canvas characterCanvas, CharacterPlayer player, Mob mob) : base(characterCanvas)
        {
            Mob          = mob;
            this.player  = player;
            UpdateThread = new Thread(Update);

            FirstX = xCharacVal;
            FirstY = yCharacVal;

            UpdateThread.Start();
        }
Пример #25
0
        public void Player_Constructor_ValidData()
        {
            Character character = new CharacterPlayer(CharacterClass.Gunner, 10);

            Assert.IsTrue(character.Class == CharacterClass.Gunner);
            Assert.IsTrue(character.HeldWeapon is WeaponKnife);
            Assert.IsTrue(character.Armor == false);
            Assert.IsTrue(character.MaxHealth == 10);
            Assert.IsTrue(character.Health == 10);
            Assert.IsTrue(character.Score == 0);
        }
Пример #26
0
 void male_Click()
 {
     if (player != null)
     {
         player.Destroy();
     }
     player = new CharacterPlayer(CharacterData.defData(EnumCharacterType.Charater_Male), resType);
     player.SetParent(playerParent.transform);
     player.Creat();
     currentType = EnumCharacterType.Charater_Male;
 }
Пример #27
0
    IEnumerator LoadDataDetailEnemyHero(int _idhero, string _idcode)
    {
        StartCoroutine(ServerAdapter.ListSkillOfHero(_idhero, _idcode, result =>
        {
            if (result.StartsWith("Error"))
            {
                Debug.Log("Do nothing");
            }
            else
            {
                SplitDataFromServe.ReadEnemySkillData(result.ToString());
            }
        }));

        WWWForm form = new WWWForm();

        form.AddField("idh", _idhero);
        form.AddField("idcode", _idcode);
        WWW w = new WWW(Constant.urlRequest + "/api/hero/detail", form);

        yield return(w);

        string data = w.text;
        var    N    = JSONNode.Parse(data);

        if (Boolean.Parse(N["return"]))
        {
            SplitDataFromServe.ReadDetailDataHeroEnemyPlay(N["data"].ToString());
            GameObject enemy = Instantiate(CharacterItemInGame.Instance._characterPrefabs[ConvertIdClassToClassName(SplitDataFromServe._heroEnemyPlay.idclass).ToString()]);
            enemy.transform.position   = new Vector3(5.5f, -2f, 0f);
            enemy.transform.localScale = new Vector3(-1f, 1f, 1f);
            _enemyCharacter            = enemy.AddComponent <CharacterPlayer>();
            CharacterPlayer.LoadCharacterEnemy(_enemyCharacter);
            //enemy.AddComponent<AnimationController>();
            enemy.SetActive(false);
            WaitingRoomUI.Instance.SetLog("Load data nhan vat thanh cong");
            if (!SocketIOController.Instance.isReconnect)
            {
                WaitingRoomUI.Instance.SetLog("Tao timeout confirm load nhan vat thanh cong");
                this.PostEvent(EventID.CreateTimeoutConfirmLoadData);
            }
            if (SocketIOController.Instance.isReconnect)
            {
                this.PostEvent(EventID.ReconnectBattleScene);
            }
            WatingRoomController.Instance.state_waitingroom = STATEINWAITING.CONFIRM_LOADDATA;
        }
        else if (!Boolean.Parse(N["return"]))
        {
            Debug.Log("Do nothing");
        }
        // if Master create timeout for done B request
        // if Slave send done slave, create timeout for done A response
    }
Пример #28
0
    public void assignPlayerTarget()
    {
        CharacterPlayer player = TurnManager.instance.getCurrentPlayer();

        if (player != null)
        {
            if (player.myAbility != null)
            {
                player.setTarget(myEnemy);
            }
        }
    }
Пример #29
0
        public void WeaponUpgrade_Pickup()
        {
            Character character = new CharacterPlayer(CharacterClass.Gunner, 10);

            Assert.IsTrue(character.HeldWeapon is WeaponKnife);

            Pickup pickup = new PickupWeaponUpgrade();

            pickup.PickUp(character);

            Assert.IsTrue(character.HeldWeapon is WeaponAR);
        }
Пример #30
0
        public void Armor_Pickup()
        {
            Character character = new CharacterPlayer(CharacterClass.Gunner, 10);

            Assert.IsTrue(character.Armor == false);

            Pickup pickup = new PickupArmor();

            pickup.PickUp(character);

            Assert.IsTrue(character.Armor == true);
        }