Пример #1
0
        public bool EndConstriction(GameObject Target, Event E = null, Constricted TargetEffect = null)
        {
            if (Target == null)
            {
                Constricted = null;
                return(true);
            }
            if (TargetEffect == null)
            {
                TargetEffect = (Target.GetEffect("Constricted") as Constricted);
                if (TargetEffect == null)
                {
                    Constricted = null;
                    return(true);
                }
            }
            if (TargetEffect.ConstrictedBy != ParentObject)
            {
                Constricted = null;
                return(true);
            }
            Target.RemoveEffect(TargetEffect);
            Target.UseEnergy(1000, "Position");
            Target.FireEvent(Event.New("Exited", "Object", ParentObject));
            Cell TargetsAdjacentPosition = Target.CurrentCell.GetRandomLocalAdjacentCell();

            // Target.DirectMoveTo(TargetsAdjacentPosition, 1000, true);
            ParentObject.FireEvent(Event.New("ObjectExited", "Object", Target));
            if (E != null)
            {
                E.RequestInterfaceExit();
            }
            Constricted = null;
            return(true);
        }
Пример #2
0
        public void EndAllConstriction()
        {
            Cell currentCell = ParentObject.CurrentCell;

            if (currentCell != null)
            {
                currentCell.ForeachObject((GameObject obj) =>
                {
                    Constricted constricted = obj.GetEffect("Constricted") as Constricted;
                    if (constricted != null && constricted.ConstrictedBy == ParentObject)
                    {
                        obj.RemoveEffect(constricted);
                    }
                });
            }
        }