예제 #1
0
    void OnTriggerStay(Collider col)
    {
        if (col.transform.parent)
        {
            if (col.transform.parent.GetComponent <W_platform>()) //Collision with mobile Platform
            {
                if (!CrossPlatformInputManager.GetButtonDown("Jump") && !Input.GetKey(KeyCode.Space))
                {
                    transform.parent = col.transform.parent;
                }
                return;
            }
        }

        if (col.transform.tag.Equals("AttackParent"))  //Collision with mobile Platform2
        {
            if (!CrossPlatformInputManager.GetButtonDown("Jump") && !Input.GetKey(KeyCode.Space))
            {
                transform.SetParent(col.transform);
            }
            return;
        }

        else if (col.transform.tag.Equals("GelidWaters"))//Entrata e staziona in acque gelide
        {
            UnFrozen = false;
            FrozenEffect.gameObject.SetActive(true);
            ShowFrozenMaterial();
            SpeedItem.RemoveScreenIcons();
            JumpItem.RemoveScreenIcons();
            m_AnimSpeedMultiplier = FrozenAnimSpeed;
            m_JumpPower           = FrozenJumpPower;
        }
    }
예제 #2
0
        public void SpeedItem_WithValues_PropertiesAreFilledCorrectly()
        {
            var itm = new SpeedItem(5000, new TimeSpan(0, 0, 1));

            Assert.AreEqual(5000, itm.Bytes);
            Assert.AreEqual(new TimeSpan(0, 0, 1), itm.Duration);
        }
예제 #3
0
 void Awake()
 {
     instance = this;
 }
예제 #4
0
        private void FormSpeedBall_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1);
            int       drawHeight = 1;
            SpeedItem thisitem   = null;

            for (int i = 0; i < Items.Count; i++)
            {
                thisitem = Items[i];

                Rectangle rectangle     = new Rectangle(1, drawHeight, Width - 2, thisitem.Height);
                Rectangle rectangleText = new Rectangle(8, drawHeight, Width - 10, thisitem.Height);

                g.FillRectangle(thisitem.bg, rectangle);

                if (thisitem.GridType == SpeedItemGridType.NoGrid)
                {
                    g.FillRectangle(thisitem.fo, new Rectangle(1, drawHeight, (int)(Width * thisitem.NumValue) - 2, thisitem.Height));
                }
                else if (thisitem.GridType == SpeedItemGridType.OneGrid)
                {
                    pts[0].X = 1;
                    pts[0].Y = rectangle.Bottom;//左下

                    for (int j = 0; j < thisitem.Data.Count; j++)
                    {
                        pts[j + 1].Y = rectangle.Bottom - thisitem.Data[j] / 100f * rectangle.Height;
                        pts[j + 1].X = rectangle.X + (j / 60f) * (Width - 2);

                        if (pts[j + 1].Y < rectangle.Y)
                        {
                            pts[j + 1].Y = rectangle.Y + 1;
                        }
                    }

                    pts[61].X = Width - 1;
                    pts[61].Y = rectangle.Bottom;//右下

                    if (thisitem.bgf != Brushes.White)
                    {
                        g.FillClosedCurve(thisitem.bgf, pts, FillMode.Alternate, 0f);
                    }
                    for (int j = 1; j < 61; j++)
                    {
                        g.DrawLine(thisitem.pfo, pts[j - 1], pts[j]);
                    }
                }
                else if (thisitem.GridType == SpeedItemGridType.TwoGrid)
                {
                    pts[0].X = 1;
                    pts[0].Y = rectangle.Bottom;//左下

                    for (int j = 0; j < thisitem.Data2.Count; j++)
                    {
                        pts[j + 1].Y = rectangle.Bottom - thisitem.Data2[j] / 100f * rectangle.Height;
                        pts[j + 1].X = rectangle.X + (j / 60f) * (Width - 2);

                        if (pts[j + 1].Y < rectangle.Y)
                        {
                            pts[j + 1].Y = rectangle.Y + 1;
                        }
                    }

                    pts[61].X = Width - 1;
                    pts[61].Y = rectangle.Bottom;//右下

                    for (int j = 1; j < 61; j++)
                    {
                        g.DrawLine(thisitem.pfo, pts[j - 1], pts[j]);
                    }
                }

                if (thisitem.TextFont == null)
                {
                    thisitem.TextFont = Font;
                }
                if (thisitem.ValueFont == null)
                {
                    thisitem.ValueFont = Font;
                }

                g.DrawString(thisitem.Text, thisitem.TextFont, Brushes.Black, rectangleText, leftCenterFormat);
                g.DrawString(thisitem.Value, thisitem.ValueFont, Brushes.Black, rectangleText, rightCenterFormat);

                drawHeight += thisitem.Height;
                if (drawHeight > Height)
                {
                    break;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// 初始化单组对战
        /// </summary>
        /// <param name="playerID"></param>
        public static MsgPack InitBattlePack(PlayerID playerID)
        {
            MsgPack battleMsg = new MsgPack();

            if (battleGroupDict.ContainsKey(playerID))
            {
                BattleGroup curBattleGroup = battleGroupDict[playerID];

                //创建SpeedItemList,添加在场所有单位
                List <SpeedItem> speedItemLists = new List <SpeedItem>();
                foreach (CampInfo c in curBattleGroup.campInfo)
                {
                    foreach (CardMsg card in c.CardItems)
                    {
                        SpeedItem item = new SpeedItem();
                        item.camp = c.Camp;
                        item.card = card;
                        speedItemLists.Add(item);
                    }
                }

                //SpeedItemList中元素依速度降序排序
                speedItemLists.Sort((x, y) => { return(y.card.Speed.CompareTo(x.card.Speed)); });
                foreach (SpeedItem s in speedItemLists)
                {
                    Console.WriteLine("camp: " + s.camp + "  pos: " + s.card.BornPos + "  speed: " + s.card.Speed + "  maxHp: " + s.card.MaxHp);
                }


                //创建消息包
                bool            isBattleEnd     = false;
                BattleGroupPack battleGroupPack = new BattleGroupPack();

                while (!isBattleEnd)
                {
                    Round round = new Round();
                    for (int j = 0; j < speedItemLists.Count; j++)
                    {
                        Console.WriteLine("============================Step start=================== ");
                        Console.WriteLine("camp: " + speedItemLists[j].camp + " selfPos: " + speedItemLists[j].card.BornPos);

                        int targetIndex = Radar.GetTargetIndex(speedItemLists, Radar.RadarType.front_first, speedItemLists[j].camp, speedItemLists[j].card.BornPos);

                        float atk = speedItemLists[j].card.Atk;
                        float def = speedItemLists[targetIndex].card.Def;

                        float damage = Math.Max(10, atk - def);

                        speedItemLists[targetIndex].card.MaxHp = Math.Max(0, speedItemLists[targetIndex].card.MaxHp - damage);

                        //speedItemLists[targetIndex].card.MaxHp = Math.Max(0, speedItemLists[targetIndex].card.MaxHp - 5);

                        #region == Pack Round Msg ==
                        AttributeResult attributeRes = new AttributeResult();
                        attributeRes.Camp    = speedItemLists[targetIndex].camp;
                        attributeRes.ResAttr = CardAttribute.CsCardMaxhp;
                        attributeRes.Value   = damage;
                        Console.WriteLine("Damage is:  " + damage);
                        StepResult stepRes = new StepResult();
                        stepRes.AttrResList.Add(attributeRes);
                        stepRes.AtkType = AtkType.CsAtktypeAtk;

                        Step step = new Step();
                        step.AtkItem      = new ActiveItem();
                        step.DefItem      = new ActiveItem();
                        step.AtkItem.Camp = speedItemLists[j].camp;
                        step.AtkItem.Card = speedItemLists[j].card;
                        step.DefItem.Camp = speedItemLists[targetIndex].camp;
                        step.DefItem.Card = speedItemLists[targetIndex].card;
                        step.StepResList.Add(stepRes);

                        round.Steps.Add(step);
                        Console.WriteLine("Camp:  " + speedItemLists[targetIndex].camp + " maxHp is: " + speedItemLists[targetIndex].card.MaxHp);
                        #endregion

                        if (speedItemLists[targetIndex].card.MaxHp == 0)
                        {
                            Console.WriteLine("Remove:  " + speedItemLists[targetIndex].camp + " " + speedItemLists[targetIndex].card.BornPos);
                            speedItemLists.RemoveAt(targetIndex);
                        }

                        int playerCount = 0;
                        int enemyCount  = 0;
                        foreach (var it in speedItemLists)
                        {
                            if (it.camp == Camps.CsCampPlayer)
                            {
                                playerCount++;
                            }
                            if (it.camp == Camps.CsCampEnemy)
                            {
                                enemyCount++;
                            }
                        }
                        Console.WriteLine("playerCount:  " + playerCount + "  enemyCount: " + enemyCount);
                        if ((playerCount == 0) || (enemyCount == 0))
                        {
                            isBattleEnd = true;
                            break;
                        }
                        Console.WriteLine("===========Step end========== ");
                        Console.WriteLine();
                    }
                    battleGroupPack.Rounds.Add(round);
                }
                battleMsg.MsgType   = MsgType.CsBattlestartRes;
                battleMsg.MsgFrom   = PlayerID.CsServe;
                battleMsg.MsgTo     = playerID;
                battleMsg.GroupPack = battleGroupPack;
            }

            return(battleMsg);
        }
예제 #6
0
 public override void Start()
 {
     base.Start();
     item = new SpeedItem();
 }