示例#1
0
        /// <summary>
        /// Lookup an object instance by name on the map.
        /// Returns the object if found, or null.
        /// </summary>
        /// <param name="instancename">Name of the object instance</param>
        /// <returns>Forund object, or null</returns>
        public GroundObject GetObj(string instancename)
        {
            GroundObject found = null;

            if ((found = GroundObjects.Find((GroundObject ch) => { return(ch.EntName == instancename); })) == null)
            {
                //Maybe warn or something??
            }
            return(found);
        }
示例#2
0
 protected GroundObject(GroundObject other) : base(other)
 {
     ScriptEvents = new Dictionary <LuaEngine.EEntLuaEventTypes, ScriptEvent>();
     foreach (LuaEngine.EEntLuaEventTypes ev in other.ScriptEvents.Keys)
     {
         ScriptEvents.Add(ev, (ScriptEvent)other.ScriptEvents[ev].Clone());
     }
     ObjectAnim = new ObjAnimData(other.ObjectAnim);
     DrawOffset = other.DrawOffset;
     Solid      = other.Solid;
 }
示例#3
0
        /// <summary>
        /// Lookup an object instance by name on the map.
        /// Returns the object if found, or null.
        /// </summary>
        /// <param name="instancename">Name of the object instance</param>
        /// <returns>Forund object, or null</returns>
        public GroundObject GetObj(string instancename)
        {
            GroundObject found = Entities[0].GroundObjects.Find((GroundObject ch) => { return(ch.EntName == instancename); });

            if (found != null)
            {
                return(found);
            }

            return(null);
        }
示例#4
0
        public IEnumerator <YieldInstruction> ProcessObjectInteract(GroundChar character)
        {
            //check to see if we're colliding with anyone

            if (character == FocusedCharacter)
            {
                //Loc front = character.GetFront() + character.CharDir.GetLoc();
                Loc start = character.MapLoc + character.CharDir.GetLoc();
                foreach (AABB.IObstacle obstacle in ZoneManager.Instance.CurrentGround.Find(new Rect(start, character.Bounds.Size)))
                {
                    if (obstacle == FocusedCharacter)
                    {
                        //do nothing
                    }
                    else if (obstacle is GroundChar)
                    {
                        GroundChar talkTo = (GroundChar)obstacle;
                        if (talkTo.EntEnabled)
                        {
                            character.CurrentCommand = new GameAction(GameAction.ActionType.None, Dir8.None);
                            yield return(CoroutineManager.Instance.StartCoroutine(talkTo.Interact(character)));

                            yield break;
                        }
                    }
                    else if (obstacle is GroundObject)
                    {
                        GroundObject groundObj = (GroundObject)obstacle;
                        if (groundObj.EntEnabled && groundObj.GetTriggerType() == GroundObject.EEntityTriggerTypes.Action)
                        {
                            character.CurrentCommand = new GameAction(GameAction.ActionType.None, Dir8.None);
                            yield return(CoroutineManager.Instance.StartCoroutine(groundObj.Interact(character)));

                            yield break;
                        }
                    }
                }
            }
        }
示例#5
0
 public void RemoveObject(GroundObject groundObj)
 {
     Entities[0].GroundObjects.Remove(groundObj);
     grid.Remove(groundObj);
 }
示例#6
0
 public void AddObject(GroundObject groundObj)
 {
     Entities[0].GroundObjects.Add(groundObj);
     grid.Add(groundObj);
 }
示例#7
0
 public void RemoveObject(GroundObject groundObj)
 {
     GroundObjects.Remove(groundObj);
     grid.Remove(groundObj);
 }
示例#8
0
 public void AddObject(GroundObject groundObj)
 {
     GroundObjects.Add(groundObj);
     grid.Add(groundObj);
 }