예제 #1
0
        public override bool FireEvent(Event E)
        {
            if (E.ID == "EnteredCell")
            {
                //IPart.AddPlayerMessage(ParentObject.DisplayName+" fell on the ground.");
                if (ParentObject.HasProperty("LimbSourceGameObjectID") && ParentObject.HasProperty("LimbSourceBodyPartID"))
                {
                    //IPart.AddPlayerMessage("it had properties!");
                    Cell       cell    = E.GetParameter("Cell") as Cell;
                    GameObject parentO = GameObject.findById(ParentObject.GetStringProperty("LimbSourceGameObjectID"));
                    if (parentO == null)
                    {
                        //IPart.AddPlayerMessage("not in cell!");

                        foreach (GameObject GO in dismeberees)
                        {
                            //IPart.AddPlayerMessage("are you my mummy("+ParentObject.GetStringProperty("LimbSourceGameObjectID")+")?"+GO.DisplayName+":"+GO.id);

                            if (GO.id == ParentObject.GetStringProperty("LimbSourceGameObjectID"))
                            {
                                parentO = GO;
                            }
                        }
                    }
                    if (parentO != null)
                    {
                        //IPart.AddPlayerMessage("it had a parent!");
                        Body body = parentO.GetPart <Body>();
                        if (body != null)
                        {
                            //IPart.AddPlayerMessage("its parent had a body!");
                            Part = DeepCopy(body.GetPartByID(ParentObject.GetIntProperty("LimbSourceBodyPartID"), true));
                        }
                    }
                }
            }

            return(base.FireEvent(E));
        }