Ejemplo n.º 1
0
    public override void Logic()
    {
        //base.Logic();
        SYPlayer p = Map.GetActorAtPos <SYPlayer>(Position, Size);

        if (p != null && p.VulnerableToCreep)
        {
            p.Hit(ImpactDamage, TKMath.GetAngle(Position, p.Position), this, ImpactForce);
            p.HitByCreep();
        }
    }
Ejemplo n.º 2
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.º 3
0
 public override void PlayerJoin(int id, string name)
 {
     playerList[id] = new SYPlayer(id, name, Vector2.Zero, this);
 }