Beispiel #1
0
        public void AddUsedTroop(CombatItemData cid, int value)
        {
            if (State == UserState.PVP)
            {
                var info = default(AttackInfo);
                if (!AttackingInfo.TryGetValue(GetId(), out info))
                {
                    Logger.Error("Unable to obtain attack info.");
                }
                else
                {
                    var dataSlot = info.UsedTroop.Find(t => t.Data.GetGlobalID() == cid.GetGlobalID());

                    if (dataSlot != null)
                    {
                        // Troops already exist.
                        int i = info.UsedTroop.IndexOf(dataSlot);
                        dataSlot.Value    = dataSlot.Value + value;
                        info.UsedTroop[i] = dataSlot;
                    }
                    else
                    {
                        DataSlot ds = new DataSlot(cid, value);
                        info.UsedTroop.Add(ds);
                    }
                }
            }
            //else
            //  Logger.Write("Unsupported state! AddUsedTroop only for PVP for now.PVE Comming Soon");
        }
    private void Awake()
    {
        this.mPlayer       = this.GetComponent <NetworkPlayer>();
        _FaceDirRotateYDic = new Dictionary <XMoveDirection, float>();
        _FaceDirRotateYDic.Add(XMoveDirection.Right, mRotateY);
        _FaceDirRotateYDic.Add(XMoveDirection.Left, mRotateY - 180);

        this.mAttackInfo = new AttackingInfo();

        this.ChangeDir(XMoveDirection.Right);
    }