Esempio n. 1
0
 private void DelayDamagePopup()
 {
     PopupTextController.PopupText(delayedMessage, delayedActor.tokenRef.transform);
     CheckForDeath(delayedActor);
     SetState(STATES.AWAITING_INPUT);
     CheckForTurnCompleted();
 }
Esempio n. 2
0
        /// <summary>
        /// Selects a random unit that still has actions this phase
        /// </summary>
        public void SelectRandomUnit()
        {
            if (type != PlayerType.Local)
            {
                return;
            }
            List <Unit> PossibleUnits = new List <Unit>();

            foreach (Unit unit in playerUnits)
            {
                if (unit.CanAttackOrMoveNow())
                {
                    PossibleUnits.Add(unit);
                }
            }

            if (PossibleUnits.Count > 0)
            {
                SelectUnit(PossibleUnits[UnityEngine.Random.Range(0, PossibleUnits.Count)]);
            }
            else
            {
                PopupTextController.AddPopupText("No more units ot act!", PopupTypes.Info);
            }
        }
Esempio n. 3
0
        void Update()
        {
            //if (Input.GetKeyDown(KeyCode.C))
            //{
            //    StartCoroutine(Start());
            //}
            //if (Input.GetKeyDown(KeyCode.S))
            //{
            //    SaveLevel();
            //}
            if (null == HeroTransform)
            {
                TypeID      entityType      = TypeID.TYPEID_BOX;
                Int64       uid             = PlayerManager.Instance.FindHeroDataModel().UID;
                EntityModel HeroEntityModel = EntityController.Instance.GetEntityModel(uid, out entityType);
                if (HeroEntityModel != null && HeroEntityModel.GO != null)
                {
                    HeroTransform = HeroEntityModel.GO.transform;
                }
            }

            if (IsShow && null != HeroTransform)
            {
                Vector3 ShowPosition = PopupTextController.GetPopupPos(HeroTransform.position + Vector3.up * 18, UICamera.mainCamera);
                CreatTipsPoint.position = ShowPosition;
            }
        }
Esempio n. 4
0
    // Walk a player or monster token to a space
    private void WalkActor(Actor actor, int xTo, int zTo)
    {
        // Find a path to the desired square, by getting a queue of sqaures to hop over
        LinkedList <TokenWalker.Hop> hopsQueue = Pathfind.FindPath(actor.x, actor.z, xTo, zTo);

        if (hopsQueue != null)
        {
            if (hopsQueue.Count > currentTurnStats.MovementLeft)
            {
                PopupTextController.PopupText("Not Enough Movement", spaces[xTo, zTo].gameSpace.transform);
            }
            else
            {
                // change the token's stored properties to its final position
                spaces[actor.x, actor.z].isBlocked = false;
                actor.x = xTo;
                actor.z = zTo;
                spaces[xTo, zTo].isBlocked = true;

                SetState(STATES.ANIMATING_ACTION);

                // Use the script attached to the token to walk the path
                actor.tokenRef.GetComponent <TokenWalker>().WalkPath(hopsQueue);
            }
        }
        else
        {
            PopupTextController.PopupText("Pathfinding failed", spaces[xTo, zTo].gameSpace.transform);
        }
    }
Esempio n. 5
0
    IEnumerator Rise(Vector3 startPos, Vector3 endPos)
    {
        float i    = 0;
        float rate = 1f / m_riseTime;

        GameObject movePoint = new GameObject();

        movePoint.transform.parent        = m_heroGO.transform;
        movePoint.transform.localPosition = Vector3.zero;
        movePoint.transform.localScale    = Vector3.one;

        while (i < 1f)
        {
            i += Time.deltaTime * rate;

            movePoint.transform.localPosition = Vector3.Lerp(startPos, endPos, i);
            Vector3 uiPos = PopupTextController.GetPopupPos(movePoint.transform.position, m_uiCamera);

            transform.position = uiPos;

            yield return(null);
        }

        Destroy(movePoint);
        yield return(new WaitForSeconds(m_stayTime));

        Destroy(gameObject);
    }
Esempio n. 6
0
    private void ShowPopUp()
    {
        if (HostPosition != null)
        {
            Vector3 uiPos = PopupTextController.GetPopupPos(HostPosition.Value, PopupObjManager.Instance.UICamera);
            transform.position = uiPos;
            switch (this.FightEffectType)
            {
            case global::FightEffectType.BATTLE_EFFECT_CRIT:
                m_tweenScale.from       = transform.localScale;
                m_tweenScale.to         = transform.localScale * CritScale;
                m_tweenPosition.enabled = false;
                m_tweenScale.enabled    = true;
                break;

            case FightEffectType.BATTLE_ADDHP:
            case FightEffectType.BATTLE_ADDMONEY:
            case FightEffectType.BATTLE_ADDMP:
            case FightEffectType.BATTLE_EFFECT_DODGE:
            case FightEffectType.BATTLE_EFFECT_HIT:
            case FightEffectType.BATTLE_EFFECT_HP:
            case FightEffectType.BATTLE_EFFECT_EXPSHOW:
                AnimShow();
                break;

            case FightEffectType.TOWN_EFFECT_ZHANLI:
                AnimShow();
                break;
            }
            m_tweenAlpha.enabled = true;
        }
    }
Esempio n. 7
0
    public void ShowHurtUiEffect(EntityModel entityModel, uint bulletId)
    {
        if (entityModel == null)
        {
            return;
        }

        BulletData    bulletData   = SkillDataManager.Instance.GetBulletData((int)bulletId);
        RoleBehaviour roleBehavior = entityModel.GO.GetComponent <RoleBehaviour>();


        if (null != roleBehavior && null != roleBehavior.HurtPoint)
        {
            if (bulletData != null)
            {
                if (null != bulletData.m_hurt_Ui_Effect)
                {
                    GameObject uiEffectObj = GameObjectPool.Instance.AcquireLocal(bulletData.m_hurt_Ui_Effect, Vector3.zero, Quaternion.identity);
                    uiEffectObj.transform.parent = PopupObjManager.Instance.UICamera.transform;
                    Vector3 uiPosition = PopupTextController.GetPopupPos(roleBehavior.HurtPoint.position, PopupObjManager.Instance.UICamera);
                    uiEffectObj.transform.position = uiPosition;
                }
            }
            else
            {
                TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "没子弹数据");
            }
        }
        else
        {
            TraceUtil.Log(SystemModel.Common, TraceLevel.Error, "没受击点");
        }
    }
Esempio n. 8
0
 public static bool CheckIfLastAttacker()
 {
     if (TurnManager.Instance.CurrentPhase == TurnPhases.Attack)
     {
         foreach (UnitScript ally in Player.Players[TurnManager.Instance.PlayerHavingTurn].PlayerUnits)
         {
             if (ally.hasAttacked == false && ally.CheckIfIsInCombat())
             {
                 return(false);
             }
         }
         PopupTextController.AddPopupText("No more units can attack!", PopupTypes.Info);
         return(true);
     }
     if (TurnManager.Instance.CurrentPhase == TurnPhases.Shooting)
     {
         foreach (UnitScript ally in Player.Players[TurnManager.Instance.PlayerHavingTurn].PlayerUnits)
         {
             if (ally.GetComponent <ShootingScript>() != null && ally.GetComponent <ShootingScript>().CanShoot)
             {
                 return(false);
             }
         }
         PopupTextController.AddPopupText("No more units can shoot!", PopupTypes.Info);
         return(true);
     }
     return(false);
 }
Esempio n. 9
0
    void Start()
    {
        GameManager.instance = this;
        SPACE_HEIGHT_MOD     = new Vector3(0f, SpaceHeight, 0f);
        PopupTextController.Initialize();

        // Build the predefined scenarios
        undeadScene = new SceneActor[] {
            new SceneActor(true, 0, 25, 17, new Color(0, 0.47f, 1f, 0.58f)), // Paladin
            new SceneActor(false, 0, 28, 27, new Color(1f, 0, 0, 0.58f)),    // Skeleton
            new SceneActor(false, 0, 13, 30, new Color(1f, 0.5f, 0, 0.58f)),
            new SceneActor(false, 0, 20, 27, new Color(1f, 0.75f, 0, 0.58f)),
            new SceneActor(false, 1, 17, 29, new Color(0.5f, 0.75f, 0.5f, 0.58f)) // Zombie
        };
        koboldScene = new SceneActor[] {
            new SceneActor(true, 1, 28, 27, new Color(0, 0.8f, 0.5f, 0.58f)),   // Heavy Weapon Fighter
            new SceneActor(true, 2, 26, 29, new Color(0, 0.47f, 0.5f, 0.58f)),  // Bow Ranger
            new SceneActor(true, 3, 27, 26, new Color(0, 0.0f, 0.5f, 0.58f)),   // Rogue
            new SceneActor(false, 2, 13, 30, new Color(1f, 0.7f, 0.8f, 0.58f)), // Basic kobold
            new SceneActor(false, 2, 15, 24, new Color(1f, 0.3f, 0.8f, 0.58f)),
            new SceneActor(false, 2, 17, 20, new Color(1f, 0.5f, 0.0f, 0.58f)),
            new SceneActor(false, 2, 18, 22, new Color(1f, 0.1f, 0.4f, 0.58f)),
            new SceneActor(false, 3, 12, 28, new Color(1f, 0.75f, 0.2f, 0.58f)), // Kobold rogue
            new SceneActor(false, 4, 18, 25, new Color(1f, 0, 0, 0.58f)),        // Kobold sorcerer
        };

        // Generate game board made of one-by-one squares
        spaces = new Space[RowsX, ColsZ];
        GenerateSquares();
    }
Esempio n. 10
0
 public void DisplayPopup(string text)
 {
     if (text == "")
     {
         return;
     }
     PopupTextController.CreatePopupText(text, transform);
 }
Esempio n. 11
0
 public bool CanAttackDestructible(DestructibleScript target, bool showText)
 {
     if (CheckIfIsInCombat() && Input.GetMouseButtonDown(0) && showText)
     {
         PopupTextController.AddPopupText("Cannot destroy objects while in combat!", PopupTypes.Info);
     }
     return(StandsNextToDestructible(target) && hasAttacked == false && CheckIfIsInCombat() == false && TurnManager.Instance.CurrentPhase == TurnPhases.Attack);
 }
Esempio n. 12
0
    public void DoAI()
    {
        //First, find who can we move! AND if nobody, then we pass turn
        Queue <UnitScript> unitsToMove = GetPossibleUnits();

        if (unitsToMove != null && unitsToMove.Count > 0)
        {
            UnitScript currentUnit = unitsToMove.Dequeue();
            if (IsInInfiniteLoop(currentUnit))
            {
                PopupTextController.AddPopupText("Bug appeared! Tell Dogo about it!", PopupTypes.Info);
                Log.SpawnLog("An AI - bug happenned. Please tell Dogo about it.");
                GameStateManager.NextPhase();
                return;
            }
            LastThreeSelectedUnits.Add(currentUnit);
            if (LastThreeSelectedUnits.Count > 3)
            {
                LastThreeSelectedUnits.RemoveAt(0);
            }
            MouseManager.Instance.SelectAUnit(currentUnit, true);

            ///////////////////// ABILITIES HERE//////////////////////////////
            // Here we should check if we want to use an active ability!
            if (CheckIfGoodToUseAbility(currentUnit))
            {
                CombatController.Instance.MakeAIWait(3f);
                return;
            }


            //Debug.Log("Starting evaluating");
            AI_Controller.Instance.EvaluateTiles(this, currentUnit, GetPossibleMoves(currentUnit, true));
            //Debug.Log("Finished evaluating");
            if (AI_Controller.tilesAreEvaluated)
            {
                var kvp = GetTheMove(currentUnit, EvaluatedTiles);
                if (this is AI_Base_Attack)
                {
                    CameraController.Instance.SetCamToU(currentUnit);
                }
                else if (this is AI_Base_Movement && (kvp.Key != null))
                {
                    CameraController.Instance.SetCamToU(currentUnit, currentUnit.transform.position != kvp.Key.transform.position);
                }
                PerformTheAction(currentUnit, kvp);
            }
        }
        if (this is AI_Attack)
        {
            CombatController.Instance.MakeAIWait(3f);
        }
        else
        {
            CombatController.Instance.MakeAIWait(1f);
        }
    }
Esempio n. 13
0
 public virtual void Attack(IDamageable target)
 {
     BattlescapeGraphics.ColouringTool.UncolourAllTiles();
     targetObject = target;
     if (sourceUnit.GetMyOwner().HasAttacksOrMovesLeft() == false)
     {
         PopupTextController.AddPopupText("No more units can attack!", PopupTypes.Info);
     }
 }
Esempio n. 14
0
 void Awake()
 {
     PopupTextController.Initialize();
     attribute = new Attribute();
     setEnemyStatus();
     health.MaxValue     = attribute.getLife();
     health.CurrentValue = health.MaxValue;
     attackRate          = attribute.getDelay();
 }
Esempio n. 15
0
 override protected void Start()
 {
     manager = Object.FindObjectOfType <TurnManager>();
     panel   = Object.FindObjectOfType <GUIPanel>();
     PopupTextController.Initialize();
     creatureMechanics = GetComponent <CreatureMechanics>();
     selectedAction    = GetComponent <ActionBasicAttack>();
     //gameSignal = (GameSignalOneObject)Resources.Load("Game Signals/SetConcentration", typeof(GameSignalOneObject));
     base.Start();
 }
Esempio n. 16
0
 public void RegenerateDefenceOutOfCombat()
 {
     if (CurrentDefence < Defence && DefenceReduction > 0)
     {
         CurrentDefence++;
         DefenceReduction--;
         PopupTextController.AddPopupText("Regenerate!", PopupTypes.Stats);
         Log.SpawnLog(name + " regenerates 1 point of defence.");
     }
 }
Esempio n. 17
0
 public void CheckIfAnyMoreUnitsToMove()
 {
     foreach (UnitScript ally in Player.Players[TurnManager.Instance.PlayerHavingTurn].PlayerUnits)
     {
         if (CanUnitMoveAtAll(ally.GetComponent <UnitMovement>()))
         {
             return;
         }
     }
     PopupTextController.AddPopupText("No more units to move!", PopupTypes.Info);
 }
Esempio n. 18
0
 public void RealNextPhase(bool didAI)
 {
     PopupTextController.ClearPopups();
     if (GameStateManager.Instance.MatchType == MatchTypes.Online)
     {
         photonView.RPC("RPCNextPhase", PhotonTargets.All, didAI);
     }
     else
     {
         SetNextPhase(didAI);
     }
 }
Esempio n. 19
0
 public void hit(int damage, bool critical, float dex)
 {
     if (alive)
     {
         int totalDamage = attribute.getHit(damage, dex);
         PopupTextController.createPopupText(totalDamage.ToString(), new Vector2(transform.position.x + 0.5f, transform.position.y + 2), critical);
         if (totalDamage > 0)
         {
             anim.Play(hitHash);
         }
         health.CurrentValue -= totalDamage;
     }
 }
Esempio n. 20
0
    public void PoisonEffect()
    {
        GetComponentInChildren <AnimController>().AnimateWound();
        PopupTextController.AddPopupText("Poison!!", PopupTypes.Info);
        Log.SpawnLog("Poison affects " + name + "!");
        if (PoisonCounter >= 4)
        {
            CurrentHP--;
            Log.SpawnLog(name + " gets 1 point of damage from poison!");
        }

        CurrentDefence--;
        PoisonCounter--;
    }
Esempio n. 21
0
 public void SetNewTurn(bool isRealGame)
 {
     if (NewTurnEvent != null)
     {
         NewTurnEvent();
     }
     text1.isOff = false;
     text2.isOff = false;
     SwitchPlayerHavingTurn();
     CurrentPhase = TurnPhases.Movement;
     if (GameStateManager.Instance.IsCurrentPlayerAI())
     {
         Debug.Log("New AI turn.");
     }
     if (isRealGame)
     {
         turnSource.Play();
         TurnCount++;
         if (TurnCount > 16)
         {
             PopupTextController.AddPopupText("Time is up!", PopupTypes.Stats);
         }
         else if (TurnCount == 16)
         {
             PopupTextController.AddPopupText("Final Turn!", PopupTypes.Damage);
             Log.SpawnLog("The last turn of the game has begun!");
             Log.SpawnLog("Movement phase begins.");
         }
         else if (TurnCount >= 11)
         {
             PopupTextController.AddPopupText("Remaining turns: " + (16 - TurnCount).ToString() + "!", PopupTypes.Damage);
             Log.SpawnLog("New turn. Remaining turns: " + (16 - TurnCount).ToString() + ".");
             Log.SpawnLog("Movement phase begins.");
         }
         else if (TurnCount > 1)
         {
             PopupTextController.AddPopupText("New Turn!", PopupTypes.Info);
             Log.SpawnLog("New turn.");
             Log.SpawnLog("Movement phase begins.");
         }
         else
         {
             PopupTextController.AddPopupText("Press Escape to see Victory Conditions!", PopupTypes.Info);
             Log.SpawnLog("Prepare for the Battle! Press Escape to see Victory Conditions!");
             Log.SpawnLog("Movement phase begins.");
         }
     }
     StartCoroutine(SetColour());
 }
Esempio n. 22
0
        public override void ModifyAttack(IDamageable target, int damageToTarget)
        {
            List <IDamageable> alreadyDamaged = new List <IDamageable>();

            foreach (Tile tile in target.currentPosition.closeNeighbours)
            {
                if (tile.GetMyDamagableObject() != null && alreadyDamaged.Contains(tile.GetMyDamagableObject()) == false)
                {
                    PopupTextController.AddPopupText("-" + splashDamage, PopupTypes.Damage);
                    Unit owner = buffGroup.owner as Unit;
                    tile.GetMyDamagableObject().TakeDamage(owner, splashDamage);
                    alreadyDamaged.Add(tile.GetMyDamagableObject());
                }
            }
        }
Esempio n. 23
0
    IEnumerator Fireball()
    {
        Log.SpawnLog("Raven empowers his shot with 'Fireball' spell, hitting " + Target.myUnit.name + " and all it's neighbours.");
        foreach (Tile neighbour in Target.GetNeighbours())
        {
            if (neighbour.myUnit != null)
            {
                neighbour.myUnit.DealDamage(Damage + myUnit.CurrentAttack - neighbour.myUnit.CurrentDefence, true, false, true);
                PopupTextController.AddParalelPopupText("-" + (Damage + myUnit.CurrentAttack - neighbour.myUnit.CurrentDefence), PopupTypes.Damage);
            }
        }
        yield return(null);

        FinishUsing();
    }
Esempio n. 24
0
 void Awake()
 {
     PopupTextController.Initialize();
     attribute = new Attribute();
     attribute.setStr(PlayerPrefs.GetFloat("str"));
     attribute.setDef(PlayerPrefs.GetFloat("def"));
     attribute.setAgi(PlayerPrefs.GetFloat("agi"));
     attribute.setDex(PlayerPrefs.GetFloat("dex"));
     attribute.setLuck(PlayerPrefs.GetFloat("luck"));
     attribute.setEnergy(PlayerPrefs.GetFloat("energy"));
     health.MaxValue     = attribute.getLife();
     health.CurrentValue = health.MaxValue;
     energy.MaxValue     = attribute.getTotalEnergy();
     energy.CurrentValue = energy.MaxValue;
     attackRate          = attribute.getDelay();
 }
Esempio n. 25
0
    void Update()
    {
        if (this.m_isReady)
        {
            if (m_EntityModel != null)
            {
                var monsterData = ((SMsgPropCreateEntity_SC_Monster)m_EntityModel.EntityDataStruct).MonsterUnitValues;
                if (monsterData.UNIT_FIELD_CURHP <= 0)
                {
                    Destroy(gameObject);
                }
                else
                {
                    HPSlider.sliderValue     = (float)monsterData.UNIT_FIELD_CURHP / m_MaxValue;
                    HPBackSlider.sliderValue = HPBackSlider.sliderValue - (HPBackSlider.sliderValue - HPSlider.sliderValue) * Time.deltaTime;
                    if (m_hasShield)
                    {
                        EnemyShieldSlider(monsterData.UNIT_FIELD_SHARD);
                    }
                    string label = string.Empty;
                    if (ShowHealthLabel)
                    {
                        label += monsterData.UNIT_FIELD_CURHP + "/" + m_MaxValue;
                    }
                    if (ShowShieldLabel)
                    {
                        if (ShowHealthLabel)
                        {
                            label += "-";
                        }
                        label += monsterData.UNIT_FIELD_SHARD + "/" + m_enemyBehaviour.MonsterShieldValue;
                    }

                    if (m_isBossHealth)
                    {
                        SetGameObjectActive(Eff_BossHaveDefense, monsterData.UNIT_FIELD_SHARD > 0);
                    }


                    this.HealthLabel.SetText(label);
                }
            }

            transform.position = PopupTextController.GetPopupPos(this.m_TargetMP.position, PopupObjManager.Instance.UICamera) + Vector3.forward * 0.5f;
        }
    }
Esempio n. 26
0
 void Update()
 {
     if (m_IsEnable)
     {
         if (m_thisEquipTrans != null)
         {
             Vector3 uiPos = PopupTextController.GetPopupPos(m_thisEquipTrans.position, m_UICamera);
             m_thisTransform.position      = new Vector3(uiPos.x, uiPos.y, m_posZ);
             m_thisTransform.localPosition = m_thisTransform.localPosition + adjustVect;
         }
         else
         {
             m_IsEnable = false;
             Destroy(gameObject);
         }
     }
 }
Esempio n. 27
0
    void CheckForInput()
    {
        if (GameStateManager.Instance.IsCurrentPlayerLocal() == false)
        {
            return;
        }
        if (Helper.IsOverNonHealthBarUI())
        {
            return;
        }
        if (GameStateManager.Instance.GameState == GameStates.AttackState && Input.GetMouseButtonDown(0) && MouseManager.Instance.SelectedUnit != null && MouseManager.Instance.MouseoveredUnit != null && MouseManager.Instance.SelectedUnit.EnemyList.Contains(MouseManager.Instance.MouseoveredUnit) && !MouseManager.Instance.SelectedUnit.hasAttacked && MouseManager.Instance.SelectedUnit.CanAttack)
        {
            SendCommandToAttack(MouseManager.Instance.SelectedUnit, MouseManager.Instance.MouseoveredUnit, false, !MouseManager.Instance.SelectedUnit.isStoppingRetaliation && MouseManager.Instance.MouseoveredUnit.DoesRetaliate);
            MouseManager.Instance.SelectedUnit.hasAttacked = true;
        }
        if (GameStateManager.Instance.GameState == GameStates.AttackState && Input.GetMouseButtonDown(0) && MouseManager.Instance.SelectedUnit != null && MouseManager.Instance.MouseoveredUnit != null && MouseManager.Instance.SelectedUnit.EnemyList.Contains(MouseManager.Instance.MouseoveredUnit.GetComponent <UnitScript>()) && !MouseManager.Instance.SelectedUnit.hasAttacked && MouseManager.Instance.SelectedUnit.CanAttack == false)
        {
            PopupTextController.AddPopupText("This unit cannot attack!", PopupTypes.Info);
        }
        //THIS below is just for testing and allows to shoot with Z key. XD. Its just for quick testing if a shot works ;) REAL shooting exists inside ShootingScript currently apparently

        /*if (MouseManager.Instance.SelectedUnit != null && MouseManager.Instance.SelectedUnit.GetComponent<ShootingScript>() != null && Input.GetKeyDown(KeyCode.Z) && MouseManager.Instance.MouseoveredUnit != null && Application.isEditor)
         * {
         *  Shoot(MouseManager.Instance.SelectedUnit, MouseManager.Instance.MouseoveredUnit, false);
         * }*/
        if (GameStateManager.Instance.GameState == GameStates.AttackState && Input.GetMouseButtonDown(0) && MouseManager.Instance.SelectedUnit != null && MouseManager.Instance.mouseoveredDestructible != null && MouseManager.Instance.SelectedUnit.CanAttackDestructible(MouseManager.Instance.mouseoveredDestructible.GetComponent <DestructibleScript>(), true))
        {
            if (GameStateManager.Instance.MatchType == MatchTypes.Online)
            {
                photonView.RPC
                (
                    "RPCMeleeAttackObstacle",
                    PhotonTargets.All,
                    Mathf.RoundToInt(MouseManager.Instance.SelectedUnit.transform.position.x),
                    Mathf.RoundToInt(MouseManager.Instance.SelectedUnit.transform.position.z),
                    Mathf.RoundToInt(MouseManager.Instance.mouseoveredDestructible.transform.position.x),
                    Mathf.RoundToInt(MouseManager.Instance.mouseoveredDestructible.transform.position.z)
                );
            }
            else
            {
                MeleeAttackObstacle(MouseManager.Instance.SelectedUnit, MouseManager.Instance.mouseoveredDestructible.GetComponent <DestructibleScript>());
            }
        }
    }
Esempio n. 28
0
        void ShowAtkInfo()
        {
            int NewAtk = HeroAttributeScale.GetScaleAttribute(HeroAttributeScaleType.Display_Combat, PlayerManager.Instance.FindHeroDataModel().UnitValues.sMsgPropCreateEntity_SC_UnitVisibleValue.UNIT_FIELD_FIGHTING);

            if (CurrentAtkNumber >= NewAtk)
            {
                CurrentAtkNumber = NewAtk;
                return;
            }
            //TraceUtil.Log("刷新人物信息");
            var addAtkNum = NewAtk - CurrentAtkNumber;
            var heroPos   = PlayerManager.Instance.FindHero().transform.position + new Vector3(CommonDefineManager.Instance.CommonDefine.HitNumber_VectorX, CommonDefineManager.Instance.CommonDefine.HitNumber_VectorY, CommonDefineManager.Instance.CommonDefine.HitNumber_VectorZ);

            PopupTextController.SettleResult(heroPos, addAtkNum.ToString(), FightEffectType.TOWN_EFFECT_ZHANLI, false);

            CurrentAtkNumber   = NewAtk;
            m_isShowZhanLiAnim = false;
        }
    /// <summary>
    /// Applies the effects.
    /// </summary>
    /// <param name="targets">Targets.</param>
    /// <param name="effects">Effects.</param>
    private IEnumerator ApplyEffects(List <Unit> targets, List <Effect> effects)
    {
        if (effects.Count <= 0)
        {
            yield break;
        }

        int index = 0;

        do
        {
            Effect effect = effects [index];
            bool   showedEffectPopupText = false;
            foreach (var target in targets)
            {
                if (target != null)
                {
                    effect.ApplyEffect(target);

                    if (effect.GetDisplayString() != "")
                    {
                        showedEffectPopupText = true;
                        PopupTextController.CreatePopupText(effect.GetDisplayString(), target.transform.position, effect.GetColor());
                    }

                    // If unit is killed after application of effect, handle death
                    target.UpdateHealthbar();
                    if (target.IsDead())
                    {
                        HandleDeath(target);
                    }
                }
            }

            // If pop up text was shown, wait x seconds so it doesn't stack with other potential ones
            if (showedEffectPopupText)
            {
                yield return(new WaitForSeconds(0.75f));
            }
            index++;
        } while (index < effects.Count);

        yield return(null);
    }
Esempio n. 30
0
    public override void Activate()
    {
        MadeEmpoweredShotThisTurn = true;
        foreach (Ability_Elves_Raven_EmpoweredShot variant in GetComponents <Ability_Elves_Raven_EmpoweredShot>())
        {
            if (variant != this)
            {
                variant.UsesLeft--;
            }
        }
        myUnit.GetComponent <UnitMovement>().LookAtTheTarget(Target.transform.position, myUnit.GetComponentInChildren <BodyTrigger>().RotationInAttack);
        myShooter.CurrentProjectile = Projectile;
        myUnit.GetComponent <AnimController>().Cast();
        Target.myUnit.DealDamage(Damage + myUnit.CurrentAttack - Target.myUnit.CurrentDefence, true, false, true);
        myShooter.hasAlreadyShot = true;

        myShooter.myTarget = Target.myUnit.transform.position;
        PopupTextController.AddParalelPopupText("-" + (Damage + myUnit.CurrentAttack - Target.myUnit.CurrentDefence), PopupTypes.Damage);
    }