public AttackCalculation(Transform attacker)
 {
     Attacker = attacker;
     CriticalHit = false;
     attackerProperty = Attacker.GetComponent<CharacterProperty>();
     attackerSelect = Attacker.GetComponent<CharacterSelect>();
     attackerLocation = attackerSelect.getMapPosition();
     sUI = Camera.mainCamera.GetComponent<DamageSlidingUI>();
 }
 public UnNormalUI(Transform chess)
 {
     int boxW = 120; int boxH = 30;
     Vector3 screenPos = Camera.main.WorldToScreenPoint(chess.position);
     screenPos.y = Screen.height - screenPos.y;
     Chess = chess;
     StartPoint = new Rect(screenPos.x-boxW/2, screenPos.y-40-boxH/2,boxW,boxH);
     Cp = chess.GetComponent<CharacterProperty>();
 }
 public BuffCalculation(Transform character)
 {
     Character = character;
     property = character.GetComponent<CharacterProperty>();
     buffList = character.GetComponent<BuffList>();
     selection = character.GetComponent<CharacterSelect>();
     addBuff = (BuffType[])buffList.addBuff.Clone();
     deBuff = (BuffType[])buffList.deBuff.Clone();
     playerSide = property.Player;
 }
 // Use this for initialization
 void Start()
 {
     cp = transform.GetComponent<CharacterProperty>();
     PassiveDict = new Dictionary<PassiveType, bool>();
     foreach(PassiveType passive in Enum.GetValues(typeof(PassiveType))){
         PassiveDict.Add(passive, false);
     }
     if((PassiveAbility!=null) && (PassiveAbility.Length>0)){
         foreach(PassiveType p in PassiveAbility){
             PassiveDict[p] = true;
         }
     }
     rUI = Camera.mainCamera.GetComponent<RoundUI>();
     infoUI = Camera.mainCamera.transform.GetComponent<MainInfoUI>();
     mUI = Camera.mainCamera.transform.GetComponent<MainUI>();
 }
        public void SetProperty(CharacterProperty property, Sprite icon)
        {
            if (Label != null)
            {
                Label.text = property.Type.ToString();
            }

            if (DisplayTooltip != null)
            {
                DisplayTooltip.Type = property.Type;
            }

            if (Value != null)
            {
                Value.text = property.Value.ToString();
            }

            if (Icon != null)
            {
                Icon.sprite = icon;
            }
        }
Exemple #6
0
    public override void Hide()
    {
        base.Hide();
        //------------背包----------------
        tempList = BackPack.Instance.AllItems();
        BackPack.Instance.ClearItems();
        BackPack.BackPackID = 1;
        BackPack.Instance.TransferItems(tempList);
        //------------背包----------------

        //------------角色----------------
        CharacterProperty chosenChar = PropertyManager.Instance.AllCharacters[0];

        //Debug.Log("HIDE" + chosenChar.Name);
        PropertyManager.Instance.ChangeCharProp(chosenChar);
        CharacterPanel.Instance.ClearEquipments();
        CharacterPanel.charPanelID = 1;
        CharacterPanel.Instance.SetEquipments(chosenChar.EquipmentProp.HeadID, chosenChar.EquipmentProp.ClothID, chosenChar.EquipmentProp.PantsID, chosenChar.EquipmentProp.BeltID, chosenChar.WeaponWith);
        PropertyManager.Instance.SetTextShow();
        CharacterPanel.Instance.CheckAllSlot();
        //------------角色----------------
    }
Exemple #7
0
    public void CreatedGFRollOver(Transform chess, GUIStyle style)
    {
        float             seg      = 3.0f;
        int               sq       = 16;
        CharacterProperty cp       = chess.GetComponent <CharacterProperty>();
        CharacterPassive  cpp      = chess.GetComponent <CharacterPassive>();
        Texture2D         headIcon = cp.SmallIcon;

        if (headIcon != null)
        {
            GUI.DrawTexture(posHeadIcon, headIcon);
        }
        Rect moveIcon = new Rect(30, 16, sq, sq);

        GUI.DrawTexture(moveIcon, Move[0]);
        GUI.Label(new Rect(moveIcon.x + sq + seg, moveIcon.y, sq, sq), cp.moveRange.ToString(), style);
        GUI.DrawTexture(new Rect(moveIcon.x + sq * 2 + seg * 2, moveIcon.y, sq, sq), Range[0]);
        GUI.Label(new Rect(moveIcon.x + sq * 3 + seg * 3, moveIcon.y, sq, sq), cp.atkRange.ToString(), style);
        GUI.DrawTexture(new Rect(moveIcon.x + sq * 4 + seg * 4, moveIcon.y, sq, sq), Damage[0]);
        GUI.Label(new Rect(moveIcon.x + sq * 5 + seg * 5, moveIcon.y, sq, sq), cp.atkPower.ToString(), style);
        GUI.DrawTexture(new Rect(moveIcon.x + sq * 6 + seg * 6, moveIcon.y, sq, sq), Hp[0]);
        GUI.Label(new Rect(moveIcon.x + sq * 7 + seg * 7, moveIcon.y, sq, sq), cp.defPower.ToString(), style);
        GUI.DrawTexture(new Rect(moveIcon.x + sq * 8 + seg * 8, moveIcon.y, sq, sq), Critiq[0]);
        GUI.Label(new Rect(moveIcon.x + sq * 9 + seg * 9, moveIcon.y, sq * 3, sq), cp.CriticalhitChance.ToString(), style);
        GUI.DrawTexture(new Rect(moveIcon.x + sq * 11 + seg * 10, moveIcon.y, sq, sq), Skill[0]);
        GUI.Label(new Rect(moveIcon.x + sq * 12 + seg * 11, moveIcon.y, sq * 3, sq), cp.SkillRate.ToString(), style);
        Rect posPass = new Rect(moveIcon.x + sq * 13 + seg * 12, 8, sq, sq);

        if (cpp.PassiveAbility.Length > 0)
        {
            int sg = 1; sq = 24;
            foreach (PassiveType pt in cpp.PassiveAbility)
            {
                GUI.DrawTexture(new Rect(posPass.x + sq * sg + seg * (sg - 1), posPass.y, sq, sq), GetPassiveTexture(pt));
                sg += 1;
            }
        }
    }
    public void AddExposedPropertiesFromData(List <ExposedPropertyData> propertiesData)
    {
        foreach (var property in propertiesData)
        {
            switch (property.propertyType)
            {
            case BlackboardType.None:
                var noneProperty = new NoneProperty()
                {
                    PropertyName = "None", propertyType = BlackboardType.None, PropertyValue = "None"
                };
                exposedProperties.Add(noneProperty);
                break;

            case BlackboardType.Character:
                var characterProperty = new CharacterProperty(property.propertyName, property.propertyValue, this);
                exposedProperties.Add(characterProperty);
                break;
            }
        }

        RepaintBlackboardNoCheck();
    }
Exemple #9
0
    public void Execute()
    {
        sUI = Camera.mainCamera.GetComponent <SkillSlidingUI>();
        CharacterProperty targetProperty = target.GetComponent <CharacterProperty>();

        if (transform.GetComponent <SkillProperty>().PassSkillRate)
        {
            targetProperty.UnStatusCounter[UnnormalStatus.Poisoned]     = 2;
            targetProperty.LastUnStatusCounter[UnnormalStatus.Poisoned] = 3;
            targetProperty.UnStatus = true;
            print("Poisoned target");
            SkillUI sui = new SkillUI(target, true, "poisoned");
            sUI.UIItems.Add(sui);
            sUI.FadeInUI = true;
        }
        else
        {
            SkillUI sui = new SkillUI(attacker, false, "");
            sUI.UIItems.Add(sui);
            sUI.FadeInUI = true;
            print("Poison failed");
        }
    }
Exemple #10
0
    public bool CanCastOn(CharacterProperty target)
    {
        if (!mOwner.HasEnoughMP(mCost) || (CoodDownLeft > 0))
        {
            return(false);
        }

//		if (Type == SkillType.HEAL && target.gameObject.layer != mOwner.gameObject.layer) {
//			return false;
//		}

        Transform ProjectileCastPoint = mOwner.transform.FindChild("ProjectileCastPoint");
        Transform CastPoint           = (ProjectileCastPoint == null) ? mOwner.transform : ProjectileCastPoint;

        float distance = Vector3.Distance(CastPoint.position, target.transform.position);

        if (distance > MaxRange)
        {
            return(false);
        }

        return(true);
    }
Exemple #11
0
    bool MoveCommand(Transform chess)
    {
        bool              moveable      = false;
        CharacterSelect   chessSelect   = chess.GetComponent <CharacterSelect>();
        CharacterProperty chessProperty = chess.GetComponent <CharacterProperty>();
        Transform         localUnit     = chessSelect.getMapPosition();
        IList             pathList      = new List <Transform>();
        Transform         sel           = decisions.GetMoveTarget(chess);

        if (sel != null)
        {
            pathList = chessSelect.FindPathList(localUnit, CurrentSel.GetSteps(localUnit, sel), sel);
            MoveCharacter mc = Camera.main.GetComponent <MoveCharacter>();
            mc.SetSteps(chess, pathList);
            chessProperty.Moved = true;
            moveable            = true;
        }
        else
        {
            moveable = false;
        }
        return(moveable);
    }
    protected override void DoAbility(CharacterProperty target)
    {
        for (int i = 0; i < Count; i++)
        {
            Vector2 randomCircle = UnityEngine.Random.insideUnitCircle * R;
            Vector3 position     = transform.position + new Vector3(randomCircle.x, 0, randomCircle.y);

            if (SummmonEffect)
            {
                GameObject SummmonEffectObj = Instantiate(SummmonEffect, position, Quaternion.identity) as GameObject;
                Observable.Timer(TimeSpan.FromSeconds(5f))
                .TakeUntilDestroy(gameObject)
                .Subscribe(x =>
                {
                    Spawn(position);
                });
            }
            else
            {
                Spawn(position);
            }
        }
    }
        public long Calc(SceneContextInfo context, CharacterProperty source, CharacterProperty target, string proc, params long[] args)
        {
            if (GlobalVariables.s_EnableCalculatorLog)
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < args.Length; ++i)
                {
                    sb.Append(args[i].ToString());
                    if (i + 1 < args.Length)
                    {
                        sb.Append(",");
                    }
                }
                LogSystem.Info("[calculator] begin calc proc {0} ({1})", proc, sb.ToString());
            }
            long ret = 0;

            m_Variables.Clear();
            List <Interpreter> exps;

            if (m_Procs.TryGetValue(proc, out exps))
            {
                for (int i = 0; i < exps.Count; ++i)
                {
                    ret = exps[i].Calc(context, source, target, args, m_Variables);
                    if (GlobalVariables.s_EnableCalculatorLog)
                    {
                        LogSystem.Info("[calculator] calc proc {0} index {1} result {2}", proc, i, ret);
                    }
                }
            }
            if (GlobalVariables.s_EnableCalculatorLog)
            {
                LogSystem.Info("[calculator] end calc proc {0}", proc);
            }
            return(ret);
        }
Exemple #14
0
    public void Execute()
    {
        sUI = Camera.mainCamera.GetComponent <SkillSlidingUI>();
        int Player = transform.parent.GetComponent <CharacterProperty>().Player;
        CharacterProperty targetProperty = target.GetComponent <CharacterProperty>();

        if (transform.GetComponent <SkillProperty>().PassSkillRate)
        {
            if (Player == 1)
            {
                chessStorage.PlayerAChesses.Add(target);
                chessStorage.PlayerBChesses.Remove(target);
                targetProperty.Player = 1;
            }
            else if (Player == 2)
            {
                chessStorage.PlayerBChesses.Add(target);
                chessStorage.PlayerAChesses.Remove(target);
                targetProperty.Player = 2;
            }
            targetProperty.UnStatusCounter[UnnormalStatus.Chaos]     = 2;
            targetProperty.LastUnStatusCounter[UnnormalStatus.Chaos] = 2;
            targetProperty.UnStatus = true;
            SkillUI sui = new SkillUI(target, true, "Chaos");
            sUI.UIItems.Add(sui);
            sUI.FadeInUI = true;
            print("Target get chaos!!");
        }
        else
        {
            SkillUI sui = new SkillUI(attacker, false, "");
            sUI.UIItems.Add(sui);
            sUI.FadeInUI = true;
            print("Chaos failed");
        }
    }
    public void SetAttackSequence(Transform attacker, Transform targetMap)
    {
        Attacker = attacker;
        //CriticalHit = false;
        attackerProperty = Attacker.GetComponent<CharacterProperty>();
        attackerSelect = Attacker.GetComponent<CharacterSelect>();
        attackerLocation = attackerSelect.getMapPosition();
        targetLocation = targetMap;
        Target = MapHelper.GetMapOccupiedObj(targetLocation);
        targetProperty = Target.GetComponent<CharacterProperty>();
        targetSelect = Target.GetComponent<CharacterSelect>();

        UpdateAttackResult(AttackType.physical);
        Vector3 pos = new Vector3(Target.transform.position.x,Target.transform.position.y,Target.transform.position.z);
        Transform blood = Instantiate(cFX.NormalAttack,pos,Quaternion.identity) as Transform;
        Destroy(GameObject.Find(blood.name).gameObject,3.0f);
        mUI.MainGuiFade = true;
        mUI.SubGuiFade = false;
    }
 // Use this for initialization
 void Start()
 {
     thisProperty = this.GetComponent<CharacterProperty>();
     originalMat = GameObject.Find("unit0").transform.renderer.material;
 }
Exemple #17
0
    public Texture2D GetIcon(BuffType mode, Transform chess)
    {
        Texture2D         icon = null;
        CharacterProperty cp   = chess.GetComponent <CharacterProperty>();

        switch (mode)
        {
        case BuffType.MoveRange:
            if (cp.BuffMoveRange == cp.moveRange)
            {
                icon = Move[0];
            }
            else if (cp.BuffMoveRange > cp.moveRange)
            {
                icon = Move[1];
            }
            else
            {
                icon = Move[2];
            }
            break;

        case BuffType.AttackRange:
            if (cp.BuffAtkRange == cp.atkRange)
            {
                icon = Range[0];
            }
            else if (cp.BuffAtkRange > cp.atkRange)
            {
                icon = Range[1];
            }
            else
            {
                icon = Range[2];
            }
            break;

        case BuffType.Attack:
            if (cp.Damage == cp.atkPower)
            {
                icon = Damage[0];
            }
            else if (cp.Damage > cp.atkPower)
            {
                icon = Damage[1];
            }
            else
            {
                icon = Damage[2];
            }
            break;

        case BuffType.Defense:
            if (cp.Hp == cp.defPower)
            {
                icon = Hp[0];
            }
            else if (cp.Hp > cp.defPower)
            {
                icon = Hp[1];
            }
            else
            {
                icon = Hp[2];
            }
            break;

        case BuffType.CriticalHit:
            if (cp.BuffCriticalHit == cp.CriticalhitChance)
            {
                icon = Critiq[0];
            }
            else if (cp.BuffCriticalHit > cp.CriticalhitChance)
            {
                icon = Critiq[1];
            }
            else
            {
                icon = Critiq[2];
            }
            break;

        case BuffType.SkillRate:
            if (cp.BuffSkillRate == cp.SkillRate)
            {
                icon = Skill[0];
            }
            else if (cp.BuffSkillRate > cp.SkillRate)
            {
                icon = Skill[1];
            }
            else
            {
                icon = Skill[2];
            }
            break;
        }
        return(icon);
    }
Exemple #18
0
 // Use this for initialization
 void Start()
 {
     towerProperty = transform.GetComponent<CharacterProperty>();
 }
Exemple #19
0
 protected override void OnTimeout(CharacterProperty target)
 {
     target.ResetWalkSpeed();
     GameObject.Destroy(effectInstance);
 }
Exemple #20
0
 public void SetOwner(CharacterProperty value)
 {
     mOwner = value;
 }
Exemple #21
0
    public Transform GetAttackTarget(Transform chess)
    {
        Transform         target         = null;
        IList             attackableList = new List <Transform>();
        CharacterProperty chessProperty  = chess.GetComponent <CharacterProperty>();
        AttackCalculation aCal           = new AttackCalculation(chess);

        attackableList = aCal.GetAttableTarget(aCal.Attacker);
        if (attackableList.Count > 0)
        {
            foreach (Transform map in attackableList)
            {
                Transform gf = MapHelper.GetMapOccupiedObj(map);
                if (chessProperty.Damage >= gf.GetComponent <CharacterProperty>().Hp)
                {
                    target = gf;
                    break;
                }
                else
                {
                    target = null;
                }
            }
            if (target == null)
            {
                foreach (Transform map in attackableList)
                {
                    Transform         gf            = MapHelper.GetMapOccupiedObj(map);
                    AttackCalculation atkCal        = new AttackCalculation(gf);
                    IList             fightBackList = atkCal.GetAttableTarget(atkCal.Attacker);
                    if (fightBackList != null && fightBackList.Count > 0)
                    {
                        bool fightBack = false;

                        foreach (Transform nMap in fightBackList)
                        {
                            Transform ngf = MapHelper.GetMapOccupiedObj(nMap);
                            if (ngf == chess)
                            {
                                fightBack = true;
                                break;
                            }
                            else
                            {
                                fightBack = false;
                            }
                        }
                        if (!fightBack)
                        {
                            target = gf;
                            break;
                        }
                        else
                        {
                            target = null;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
            }
            if (target == null)
            {
                foreach (Transform map in attackableList)
                {
                    Transform gf = MapHelper.GetMapOccupiedObj(map);
                    if (chessProperty.Hp > gf.GetComponent <CharacterProperty>().Damage)
                    {
                        target = gf;
                        break;
                    }
                }
            }
        }
        return(target);
    }
 public Damage(CharacterProperty from, CharacterProperty to, float damage)
 {
     this.from  = from;
     this.to    = to;
     this.value = damage;
 }
Exemple #23
0
 protected override void OnCanceled(CharacterProperty target)
 {
     GameObject.Destroy(effectInstance);
 }
    // Use this for initialization
    void Start()
    {
        MoveRangeList =  new List<Transform>();
        AttackRangeList = new List<Transform>();

        MoveRangeList.Clear();
        AttackRangeList.Clear();
        thisProperty = this.GetComponent<CharacterProperty>();
        //originalMat = GameObject.Find("unit0").transform.renderer.material;
    }
Exemple #25
0
    public static Ability CreateAbility(CharacterProperty agent, int id)
    {
        if (id == 0)
        {
            Ability ability = new Ability(agent, 0, "IceArrow", 2.0f, 1.0f)
                              .AddAction(new ProjectileAction(10, "Arrows/IceArrow", 8))
                              .AddAction(new DamageAction(5))
                              .AddAction(new EffectAction(new Effect[] {
                new SlowEffect(5.0f, 0.5f)
            }));

            return(ability);
        }
        else if (id == 1)
        {
            Ability ability = new Ability(agent, 1, "FireBall", 0.0f, 10.0f)
                              .AddAction(new DelayAction(0.3f))
                              .AddAction(new ProjectileAction(10, "FireMega", 5))
                              .AddAction(new DamageAction(20))
                              .AddAction(new EffectAction(new Effect[] {
                new SlowEffect(5.0f, 0.5f)
            }));
            return(ability);
        }
        else if (id == 2)
        {
            Ability ability = new Ability(agent, 2, "Heal", 3.0f, 1.0f)
                              .AddAction(new HealAction(10));
            return(ability);
        }
        else if (id == 3)
        {
            Ability ability = new Ability(agent, 3, "Explose On Dead", 3.0f, 20.0f)
                              .AddAction(new EffectAction(new Effect[] {
                new AfterDiedEffect("Effects/Blasts/WaterSphereBlast")
            }));
            return(ability);
        }
        else if (id == 4)
        {
            Ability ability = new Ability(agent, 4, "Storm Blast", 10.0f, 10.0f)
                              .AddAction(new BlastAction(10, 10, "Effects/Blasts/ShadowSphereBlast"));
            return(ability);
        }
        else if (id == 5)
        {
            Ability ability = new Ability(agent, 5, "Physic Attack", 3.0f, 0.0f)
                              .AddAction(new DamageAction(50));
            return(ability);
        }
        else if (id == 6)
        {
            Ability ability = new Ability(agent, 6, "Physic 3xAttack", 3.0f, 0.0f)
                              .AddAction(new AnimationAction("attack0", "attack0_0"))
                              .AddAction(new DamageAction(5))
                              .AddAction(new AnimationAction("attack0", "attack0_1"))
                              .AddAction(new DamageAction(10))
                              .AddAction(new AnimationAction("attack0", "attack0_2"))
                              .AddAction(new DamageAction(30));
            return(ability);
        }
        return(null);
    }
Exemple #26
0
    void updateUnnormalStatus()
    {
        foreach (Transform chess in AllChesses)
        {
            CharacterProperty cProperty = chess.GetComponent <CharacterProperty>();
            cProperty.UnStatus = false;
            List <UnnormalStatus> keys = new List <UnnormalStatus>(cProperty.UnStatusCounter.Keys);
            foreach (UnnormalStatus key in keys)
            {
                if (cProperty.UnStatusCounter[key] > 0)
                {
                    cProperty.UnStatus = true;
                    switch (key)
                    {
                    case UnnormalStatus.Burned:
                        break;

                    case UnnormalStatus.Chaos:
                        cProperty.Moved        = true;
                        cProperty.Activated    = true;
                        cProperty.Attacked     = true;
                        cProperty.TurnFinished = true;
                        break;

                    case UnnormalStatus.Freezed:
                        cProperty.Moved = true;
                        break;

                    case UnnormalStatus.Poisoned:
                        cProperty.Hp -= 1;
                        break;

                    case UnnormalStatus.Sleeping:
                        break;

                    case UnnormalStatus.Wounded:
                        cProperty.AbleRestore = false;
                        break;
                    }
                    cProperty.UnStatusCounter[key] -= 1;
                }
                else
                {
                    switch (key)
                    {
                    case UnnormalStatus.Burned:
                        break;

                    case UnnormalStatus.Chaos:
                        break;

                    case UnnormalStatus.Freezed:
                        break;

                    case UnnormalStatus.Poisoned:
                        break;

                    case UnnormalStatus.Sleeping:
                        break;

                    case UnnormalStatus.Wounded:
                        cProperty.AbleRestore = true;
                        break;
                    }
                }
                if (cProperty.LastUnStatusCounter[key] > 0)
                {
                    cProperty.LastUnStatusCounter[key] -= 1;
                }
            }
        }
    }
 protected virtual void DoAbility(CharacterProperty target)
 {
 }
Exemple #28
0
    void CreateContent(Transform chess)
    {
        int  seg       = 3;
        int  texWidthA = 25;
        int  texWidthB = 35;
        int  texWidthC = 15;
        Rect startRect = new Rect();

        if (chess == leftChess)
        {
            startRect = posLeftContent;
        }
        else
        {
            startRect = posRightContent;
        }

        CharacterProperty cp  = chess.GetComponent <CharacterProperty>();
        CharacterPassive  cpp = chess.GetComponent <CharacterPassive>();

        GUI.DrawTexture(startRect, iconVault.GetIcon(BuffType.MoveRange, chess));
        Rect secCol = new Rect(startRect.x + iconWidth + seg, startRect.y - 10, 25, 30);

        GUI.Label(secCol, cp.BuffMoveRange.ToString(), numberStyle[1]);
        Rect thirdCol = new Rect(secCol.x + texWidthA, startRect.y, iconWidth, iconWidth);

        GUI.DrawTexture(thirdCol, iconVault.GetIcon(BuffType.AttackRange, chess));
        Rect forthCol = new Rect(thirdCol.x + iconWidth + seg, secCol.y, 25, 30);

        GUI.Label(forthCol, cp.BuffAtkRange.ToString(), numberStyle[1]);
        Rect fifthCol = new Rect(forthCol.x + texWidthA, startRect.y, iconWidth, iconWidth);

        GUI.DrawTexture(fifthCol, iconVault.GetIcon(BuffType.Attack, chess));
        Rect sixthCol = new Rect(fifthCol.x + iconWidth + seg, startRect.y - 24, 30, 44);

        if (cp.Damage <= 0)
        {
            cp.Damage = 0;
        }
        GUI.Label(sixthCol, cp.Damage.ToString(), numberStyle[2]);
        Rect seventhCol = new Rect(sixthCol.x + texWidthB, startRect.y, iconWidth, iconWidth);

        GUI.DrawTexture(seventhCol, iconVault.GetIcon(BuffType.Defense, chess));
        Rect eightCol = new Rect(seventhCol.x + iconWidth + seg, sixthCol.y, 50, 44);

        if (cp.Hp <= 0)
        {
            cp.Hp = 0;
        }
        GUI.Label(eightCol, cp.Hp.ToString(), numberStyle[2]);
        Rect ninthCol = new Rect(startRect.x, startRect.y + 35, iconWidth, iconWidth);

        GUI.DrawTexture(ninthCol, iconVault.GetIcon(BuffType.CriticalHit, chess));
        Rect tenthCol = new Rect(secCol.x, ninthCol.y - 4, texWidthC * 3, 24);

        if (cp.BuffCriticalHit <= 0)
        {
            cp.BuffCriticalHit = 0;
        }
        GUI.Label(tenthCol, cp.BuffCriticalHit.ToString(), numberStyle[0]);
        Rect elevthCol = new Rect(tenthCol.x + tenthCol.width, ninthCol.y, iconWidth, iconWidth);

        GUI.DrawTexture(elevthCol, iconVault.GetIcon(BuffType.SkillRate, chess));
        Rect twelvthCol = new Rect(elevthCol.x + iconWidth + seg, tenthCol.y, texWidthC * 3, 24);

        if (cp.BuffSkillRate <= 0)
        {
            cp.BuffSkillRate = 0;
        }
        GUI.Label(twelvthCol, cp.BuffSkillRate.ToString(), numberStyle[0]);
        Rect posPass = new Rect(twelvthCol.x + twelvthCol.width, elevthCol.y, iconWidth, iconWidth);

        if (cpp.PassiveAbility.Length > 0)
        {
            int sg = 0; int sq = 20;
            foreach (var pt in cpp.PassiveDict)
            {
                if (pt.Value)
                {
                    GUI.DrawTexture(new Rect(posPass.x + sq * sg + seg * (sg - 1), posPass.y, sq, sq), iconVault.GetPassiveTexture(pt.Key));
                    sg += 1;
                }
            }
        }
        if (cp.Hp <= 0)
        {
            GUI.DrawTexture(new Rect(startRect.x, startRect.y - 50, 220, 110), Dead);
        }
        if (Critical)
        {
            GUI.DrawTexture(new Rect(posLeftContent.x, posLeftContent.y - 70, 180, 90), criticalImg);
        }
        if (CriticalRight)
        {
            GUI.DrawTexture(new Rect(posRightContent.x, posRightContent.y - 70, 180, 90), criticalImg);
        }
    }
 public AbstractZombie(CharacterProperty property, ZombieColor zombieColor)
 {
     this.property = property;
     this.color    = zombieColor;
 }
 public AbstractZombie(CharacterProperty property) : this(property, ZombieColor.Unpainted)
 {
 }
Exemple #31
0
    void OnGUI()
    {
        GUI.color = new Color(1.0f, 1.0f, 1.0f, _mainAlpha);

        if (ShowUI)
        {
            if (leftChess != null)
            {
                CharacterProperty lcp = leftChess.GetComponent <CharacterProperty>();
                GUI.Label(posLeftTitle, lcp.NameString, titleStyle);
                GUI.DrawTexture(leftInfoWin, InfoWindow);
                GUI.DrawTexture(leftChessPos, lcp.BigIcon);
                CreateContent(leftChess);
            }
        }

        GUI.color = new Color(1.0f, 1.0f, 1.0f, _targetAlpha);

        if (ShowTarget)
        {
            if (rightChess != null)
            {
                CharacterProperty rcp = rightChess.GetComponent <CharacterProperty>();
                GUI.Label(posRightTitle, rcp.NameString, titleStyle);
                GUI.DrawTexture(rightInfoWin, InfoWindow);
                GUI.DrawTextureWithTexCoords(rightChessPos, rcp.BigIcon, mirrorRect, true);
                CreateContent(rightChess);
            }
        }

        GUI.color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
        playerA   = rc.playerA;
        playerB   = rc.playerB;
        GUI.DrawTexture(new Rect(0, Screen.height - 60, Screen.width, 60), UnderBar);
        GUI.DrawTexture(new Rect(0, Screen.height - 60, 100, 60), Black);
        GUI.DrawTexture(new Rect(Screen.width - 100, Screen.height - 60, 100, 60), Black);
        if (playerSide == 1)
        {
            GUI.DrawTexture(new Rect(10, Screen.height - 68, 78, 78), ManaA);
            GUI.DrawTexture(new Rect(Screen.width - 90, Screen.height - 68, 78, 78), ManaB);
            GUI.Box(new Rect(40, Screen.height - 50, 30, 40), playerA.GetComponent <ManaCounter>().Mana.ToString(), manaStyle);
            GUI.Box(new Rect(Screen.width - 62, Screen.height - 50, 30, 40), playerB.GetComponent <ManaCounter>().Mana.ToString(), manaStyle);
        }
        else if (playerSide == 2)
        {
            GUI.DrawTexture(new Rect(10, Screen.height - 68, 78, 78), ManaB);
            GUI.DrawTexture(new Rect(Screen.width - 90, Screen.height - 68, 78, 78), ManaA);
            GUI.Box(new Rect(40, Screen.height - 50, 30, 40), playerB.GetComponent <ManaCounter>().Mana.ToString(), manaStyle);
            GUI.Box(new Rect(Screen.width - 62, Screen.height - 50, 30, 40), playerA.GetComponent <ManaCounter>().Mana.ToString(), manaStyle);
        }
        GUI.DrawTexture(new Rect(Screen.width / 2 - 150, Screen.height - 104, 300, 114), RoundCounterImg);
        GUI.Box(new Rect(Screen.width / 2 - 37.5f, Screen.height - 73, 75, 50), rc.roundCounter.ToString(), roundStyle);
        //
        if (playerSide == 1)
        {
            int seg = 3; int iWidth = 50; int t = 0;
            foreach (Transform gf in rc.PlayerAChesses)
            {
                CharacterProperty gfp = gf.GetComponent <CharacterProperty>();
                if (!gfp.death)
                {
                    GUI.enabled = true;
                }
                else
                {
                    GUI.enabled = false;
                }
                GUI.Button(new Rect(posAChessList.x + t * (seg + iWidth), posAChessList.y, iWidth, iWidth), gfp.SmallIcon, manaStyle);
                t += 1;
            }
            int s = 0;
            foreach (Transform gf in rc.PlayerBChesses)
            {
                CharacterProperty gfp = gf.GetComponent <CharacterProperty>();
                if (!gfp.death)
                {
                    GUI.enabled = true;
                }
                else
                {
                    GUI.enabled = false;
                }
                GUI.Button(new Rect(posBChessList.x - s * (seg + iWidth), posBChessList.y, iWidth, iWidth), gfp.SmallIcon, manaStyle);
                s += 1;
            }
        }
        else if (playerSide == 2)
        {
            int seg = 3; int iWidth = 50; int t = 0;
            foreach (Transform gf in rc.PlayerBChesses)
            {
                CharacterProperty gfp = gf.GetComponent <CharacterProperty>();
                if (!gfp.death)
                {
                    GUI.enabled = true;
                }
                else
                {
                    GUI.enabled = false;
                }
                GUI.Button(new Rect(posAChessList.x + t * (seg + iWidth), posAChessList.y, iWidth, iWidth), gfp.SmallIcon, manaStyle);
                t += 1;
            }
            int s = 0;
            foreach (Transform gf in rc.PlayerAChesses)
            {
                CharacterProperty gfp = gf.GetComponent <CharacterProperty>();
                if (!gfp.death)
                {
                    GUI.enabled = true;
                }
                else
                {
                    GUI.enabled = false;
                }
                GUI.Button(new Rect(posBChessList.x - s * (seg + iWidth), posBChessList.y, iWidth, iWidth), gfp.SmallIcon, manaStyle);
                s += 1;
            }
        }
    }
 protected override void OnCanceled(CharacterProperty target)
 {
 }
 public bool CanCastSkill(int skillID, CharacterProperty target)
 {
     return(CanCastSkill(skillID, mCharacterProperty, target));
 }
Exemple #34
0
 public ZombieJack(CharacterProperty property, ZombieColor color) : base(property, color)
 {
 }
Exemple #35
0
    public UICommands GetFirstCommand(Transform chess)
    {
        UICommands        uiCmds        = UICommands.none;
        CharacterProperty chessProperty = chess.GetComponent <CharacterProperty>();

        if (chessProperty.Summoner)
        {
            if (MapHelper.Attackable(chess))
            {
                if (KillAble(chess, 0, chessProperty.Damage))
                {
                    uiCmds = UICommands.Attack;
                }
                else
                {
                    uiCmds = UICommands.Defense;
                }
            }
            else
            {
                uiCmds = UICommands.Move;
                Transform map = GetMoveTarget(chess);
                if (map == null)
                {
                    uiCmds = UICommands.Defense;
                }
            }
        }
        else
        {
            if (MapHelper.Attackable(chess))
            {
                if (KillAble(chess, 0, chessProperty.Damage) || KillAble(chess, 1, 0))
                {
                    uiCmds = UICommands.Attack;
                }
                else
                {
                    uiCmds = UICommands.none;
                }
            }
            else
            {
                uiCmds = UICommands.Move;
            }

            if (uiCmds == UICommands.none)
            {
                Transform[] skills = chess.GetComponent <SkillSets>().Skills;
                foreach (Transform skill in skills)
                {
                    if (currentSelect.player.GetComponent <ManaCounter>().Mana >= skill.GetComponent <SkillProperty>().SkillCost)
                    {
                        SkillProperty skillProperty = skill.GetComponent <SkillProperty>();
                        if (skillProperty.SType == SkillType.EnhanceSelf && skillProperty.Mode == PowerType.Damage)
                        {
                            int newDamage = chessProperty.Damage + skillProperty.ModeValue;
                            if (KillAble(chess, 0, newDamage))
                            {
                                uiCmds = UICommands.Skill;
                            }
                            else
                            {
                                uiCmds = UICommands.Move;
                            }
                        }
                        else
                        {
                            uiCmds = UICommands.Move;
                        }
                    }
                    else
                    {
                        uiCmds = UICommands.Move;
                    }
                }
            }
        }
        return(uiCmds);
    }
Exemple #36
0
 public ZombieJack(CharacterProperty property) : this(property, ZombieColor.Unpainted)
 {
 }
Exemple #37
0
    public UICommands GetSecondCommand(Transform chess)
    {
        UICommands        uiCmds  = UICommands.none;
        CharacterProperty chessP  = chess.GetComponent <CharacterProperty>();
        AIMoveStore       chessAI = new AIMoveStore(chess);

        if (chessAI.CmdsUsed.Count <= 1)
        {
            if (chessP.Summoner)
            {
                if (chessAI.CmdsLeft.Contains(UICommands.Attack) && MapHelper.Attackable(chess))
                {
                    if (KillAble(chess, 0, chessP.Damage))
                    {
                        uiCmds = UICommands.Attack;
                    }
                    else if (chessAI.CmdsLeft.Contains(UICommands.Defense))
                    {
                        uiCmds = UICommands.Defense;
                    }
                }
                else if (chessAI.CmdsUsed.Contains(UICommands.Move))
                {
                    uiCmds = UICommands.Defense;
                }
                else if (chessAI.CmdsUsed.Contains(UICommands.Defense))
                {
                    //check if summonable
                    Transform summonGF  = GetSummonGF(chess);
                    Transform summonPos = GetSummonPosition(chess);
                    if (summonGF != null && summonPos != null)
                    {
                        uiCmds = UICommands.Summon;
                    }
                }
            }
            else
            {
                if (MapHelper.Attackable(chess))
                {
                    if (KillAble(chess, 0, chessP.Damage) || KillAble(chess, 1, 0))
                    {
                        if (chessAI.CmdsLeft.Contains(UICommands.Attack))
                        {
                            uiCmds = UICommands.Attack;
                        }
                    }
                    else
                    {
                        Transform[] skills = chess.GetComponent <SkillSets>().Skills;
                        foreach (Transform skill in skills)
                        {
                            if (currentSelect.player.GetComponent <ManaCounter>().Mana >= skill.GetComponent <SkillProperty>().SkillCost)
                            {
                                SkillProperty skillProperty = skill.GetComponent <SkillProperty>();
                                if (skillProperty.SType == SkillType.EnhanceSelf && skillProperty.Mode == PowerType.Damage)
                                {
                                    int newDamage = chessP.Damage + skillProperty.ModeValue;
                                    if (KillAble(chess, 0, newDamage) && chessAI.CmdsLeft.Contains(UICommands.Skill))
                                    {
                                        uiCmds = UICommands.Skill;
                                    }
                                    else if (chessAI.CmdsLeft.Contains(UICommands.Move))
                                    {
                                        uiCmds = UICommands.Move;
                                    }
                                }
                                else if (chessAI.CmdsLeft.Contains(UICommands.Move))
                                {
                                    uiCmds = UICommands.Move;
                                }
                            }
                            else if (chessAI.CmdsLeft.Contains(UICommands.Move))
                            {
                                uiCmds = UICommands.Move;
                            }
                        }
                    }
                }
            }
        }
        else
        {
            print("what a f**k, it's not second move");
        }

        return(uiCmds);
    }
 protected override void OnTimeout(CharacterProperty target)
 {
 }