Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        time = (TimeManager)FindObjectOfType(typeof(TimeManager)); //Set Time manager
        foreach (Transform child in transform)
        {
            if (child.CompareTag("Renderer"))
            {
                bodyRenderTransform = child;
            }
        }
        //Set bodyRender equal to the transform of the proper childObject

        harmQuant     = 0f;
        harmThreshold = 1f;

        hinderQuant     = 0f;
        hinderThreshold = 1f;

        currMoveAct = new HaltAction("Halt", 0, this);
        currAct     = new Action("Open", 0, this);
        AddAffecter(new ResistanceAggregate(this, 0f));

        mind        = new Inanimate(null, this);
        interacting = false;
        outline     = GetComponent <SpriteOutline>();
        inventory   = new List <Item> {
            new Sword(this, 1)
        };
        CreateItemPackage(inventory, "RChest", 5.5f);
    }
Beispiel #2
0
        /// <summary>
        /// Executes this command
        /// </summary>
        public override void Execute()
        {
            var       newObject = (IInanimateData)Subject;
            var       sb        = new List <string>();
            IContains spawnTo;

            //No target = spawn to room you're in
            if (Target != null)
            {
                spawnTo = (IContains)Target;
            }
            else
            {
                spawnTo = OriginLocation;
            }

            var entityObject = new Inanimate(newObject, spawnTo);

            //TODO: keywords is janky, location should have its own identifier name somehow for output purposes - DISPLAY short/long NAME
            sb.Add(string.Format("{0} spawned to {1}", entityObject.DataTemplate.Name, spawnTo.Keywords[0]));

            var messagingObject = new MessageCluster(sb, new string[] { "You are ALIVE" }, new string[] { "You have been given $S$" }, new string[] { "$S$ appears in the $T$." }, new string[] { });

            messagingObject.ExecuteMessaging(Actor, entityObject, spawnTo, OriginLocation, null);
        }
Beispiel #3
0
 private static Entity InanimateEntity(GameplayState gs, Inanimate inanimate) =>
 inanimate.Type.Match(
     vase: () =>
 {
     var e = new Entity();
     e.AddComponent(new SpriteRenderer("Vase")
     {
         Layer = "Inanimates"
     });
     e.AddComponent(new InanimateController(gs, inanimate));
     e.Transform.Position = inanimate.Position + new Vector2(64, 64);
     return(e);
 },
     sacrificialFirePit: () =>
 {
     var e = new Entity();
     e.AddComponent(new SpriteRenderer("SacrificialFirePit")
     {
         Layer = "Inanimates"
     });
     e.AddComponent(new SacrificePitController(gs));
     e.Transform.Position = inanimate.Position + new Vector2(128, 128);
     return(e);
 }
     );
Beispiel #4
0
 public InanimateController(GameplayState gs, Inanimate inanimate)
 {
     _inanimate = inanimate;
     _gs        = gs;
 }