Esempio n. 1
0
        public override void Attach(LogicUnit g, LogicUnit t)
        {
            DebugUtils.Log(DebugUtils.Type.AI_AttributeEffect, string.Format("{0} {1} has been attached a {2} {3} {4} to {5} mark unit {6}", g.type, g.id, type, attributeAffectType, metaId, t.mark, t.id));
            state = AttributeEffectState.StartRelease;

            giver = g;
            taker = t;
            // owner will always be taker...
            owner = taker;

            if (t.type == LogicUnitType.Soldier)
            {
                Soldier s = (Soldier)taker;
                ownerBuff = s.buffHandler;
            }
            else if (t.type == LogicUnitType.NPC)
            {
                Npc n = (Npc)taker;
                ownerBuff = n.buffHandler;
            }
            else if (t.type == LogicUnitType.Demolisher)
            {
                Demolisher d = (Demolisher)taker;
                ownerBuff = d.buffHandler;
            }
            else if (t.type == LogicUnitType.CrystalCar)
            {
                CrystalCar c = (CrystalCar)taker;
                ownerBuff = c.buffHandler;
            }
            else
            {
                DebugUtils.LogWarning(DebugUtils.Type.AI_AttributeEffect, string.Format("{0} {1} can't handle {2} now!", t.type, t.id, attributeAffectType));
            }

            if (ownerBuff != null && effectResId != 0)
            {
                RenderMessage rm = new RenderMessage();
                rm.type    = RenderMessage.Type.AttachAttributeEffect;
                rm.ownerId = id;
                rm.arguments.Add("HolderType", (int)t.type);
                rm.arguments.Add("HolderId", t.id);
                rm.arguments.Add("resId", effectResId);
                rm.arguments.Add("bindPointName", effectBindPoint);

                PostRenderMessage(rm);
            }
        }
Esempio n. 2
0
        public int Mined(int h, CrystalCar c)
        {
            int harvest = 0;

            if (Alive())
            {
                if (OwnerLess() || SameOwner(c.mark))
                {
                    DebugUtils.Log(DebugUtils.Type.AI_Crystal, "Crystal has been occupied by" + c.mark);
                    ownerMark = c.mark;
                }
                else
                {
                    return(harvest);
                }

                if (hp - h >= 0)
                {
                    hp     -= h;
                    harvest = h;
                }
                else
                {
                    hp      = 0;
                    harvest = (int)hp;
                }

                RenderMessage message = new RenderMessage();
                message.type    = RenderMessage.Type.CrystalMined;
                message.ownerId = id;
                message.arguments.Add("value", harvest);
                PostRenderMessage(message);

                // Timing Hurt Gap
                removeOwnerTimer = 0;
            }

            return(harvest);
        }
Esempio n. 3
0
 public CrystalCarFsmWalk(CrystalCar crystalCar)
 {
     owner = crystalCar;
 }
Esempio n. 4
0
 public CrystalCarFsmMining(CrystalCar crystalCar)
 {
     owner = crystalCar;
 }
Esempio n. 5
0
 public CrystalCarFsmChase(CrystalCar car)
 {
     owner = car;
 }
Esempio n. 6
0
 public CrystalCarFsmPlaceHolder(CrystalCar car)
 {
     owner = car;
 }
Esempio n. 7
0
 public CrystalCarFsmIdle(CrystalCar car)
 {
     owner = car;
 }
Esempio n. 8
0
 public CrystalCarFsmDead(CrystalCar crystalCar)
 {
     owner = crystalCar;
 }