Ejemplo n.º 1
0
    public void CreateScrap(int id, Vector2 position, Vector2 velocity)
    {
        if (scrapList[id] != null)
        {
            RemoveScrap(id);
        }

        scrapList[id] = new SYScrap(id, position, velocity, this);
    }
Ejemplo n.º 2
0
    public void CreateScrap(Vector2 position)
    {
        while (scrapList[scrapIndex] != null)
        {
            scrapIndex = (scrapIndex + 1) % scrapList.Length;
        }

        scrapList[scrapIndex] = new SYScrap(scrapIndex, position, this);
        scrapIndex            = (scrapIndex + 1) % scrapList.Length;
    }
Ejemplo n.º 3
0
 public void CollectScrap(SYScrap s)
 {
     s.CollectedBy(this);
 }
Ejemplo n.º 4
0
    public override void MessageHandle(EZUDP.MessageBuffer msg)
    {
        try
        {
            if ((Protocol)msg.ReadShort() == Protocol.MapArgument)
            {
                switch ((Protocol_SY)msg.ReadShort())
                {
                case Protocol_SY.PlayerScrap:
                    (playerList[msg.ReadByte()] as SYPlayer).ReceiveScrap(msg.ReadByte());
                    break;

                case Protocol_SY.ScrapGainEffect:
                    AddEffect(new EffectGainScrap(msg.ReadVector2(), msg.ReadShort(), this));
                    break;

                case Protocol_SY.ScrapExistance:
                    CreateScrap(msg.ReadShort(), msg.ReadVector2(), msg.ReadVector2());
                    break;

                case Protocol_SY.ScrapCollect:
                {
                    SYScrap  scrap  = scrapList[msg.ReadShort()];
                    SYPlayer player = (SYPlayer)playerList[msg.ReadByte()];

                    player.CollectScrap(scrap);

                    break;
                }

                case Protocol_SY.ScrapReturn:
                    ((SYPlayer)playerList[msg.ReadByte()]).ReturnScrap(stashList[msg.ReadByte()]);
                    break;

                case Protocol_SY.StashScrapAmount:
                    stashList[msg.ReadByte()].SetScrap(msg.ReadShort());
                    break;

                case Protocol_SY.CreepExistance:
                    SpawnCreep((CreepType)msg.ReadByte(), msg.ReadByte(), msg.ReadVector2(), msg.ReadVector2());
                    break;

                case Protocol_SY.CreepPosition:
                    creepList[msg.ReadByte()].ReceivePosition(msg.ReadVector2(), msg.ReadVector2());
                    break;

                case Protocol_SY.CreepHit:
                    creepList[msg.ReadByte()].ReceiveHit(msg.ReadFloat(), msg.ReadFloat(), msg);
                    break;

                case Protocol_SY.CreepDie:
                    creepList[msg.ReadByte()].Die(msg.ReadVector2());
                    break;

                case Protocol_SY.CreepCustom:
                    creepList[msg.ReadByte()].ReceiveCustom(msg);
                    break;

                case Protocol_SY.TowerExistance:
                {
                    int id = msg.ReadByte();
                    //SYTowerPoint stash = stashList[msg.ReadByte()] as SYTowerPoint;

                    towerList[id] = new SYTower(id, msg.ReadByte(), msg.ReadVector2(), this);
                    break;
                }

                case Protocol_SY.TowerRotation:
                    towerList[msg.ReadByte()].ReceiveRotation(msg.ReadFloat());
                    break;

                case Protocol_SY.TowerTarget:
                    towerList[msg.ReadByte()].ReceiveTarget(msg.ReadByte());
                    break;

                case Protocol_SY.TowerShoot:
                    towerList[msg.ReadByte()].ReceiveShoot(msg.ReadVector2(), msg.ReadByte());
                    break;

                case Protocol_SY.TowerHit:
                    towerList[msg.ReadByte()].ReceiveHit(msg.ReadFloat(), msg.ReadFloat(), msg.ReadByte(), msg.ReadVector2());
                    break;

                case Protocol_SY.TowerDie:
                    towerList[msg.ReadByte()].ReceiveDie();
                    break;

                case Protocol_SY.BaseHit:
                    baseList[msg.ReadByte()].ReceiveHit(msg.ReadFloat(), msg.ReadFloat(), msg.ReadByte(), msg.ReadVector2());
                    break;
                }
            }
        }
        catch (Exception e)
        {
            Log.Write(ConsoleColor.Yellow, "Packet corrupt!");
            Log.Write(ConsoleColor.Red, e.Message);
            Log.Write(ConsoleColor.DarkRed, e.StackTrace);
        }

        if (msg != null)
        {
            msg.Reset();
        }

        base.MessageHandle(msg);
    }
Ejemplo n.º 5
0
 public void RemoveScrap(SYScrap scrap)
 {
     RemoveScrap(scrap.id);
 }
Ejemplo n.º 6
0
 public void CollectScrap(SYScrap s)
 {
     s.CollectedBy(this);
     GainScrap(1, s.Position);
 }