示例#1
0
    public override Action[] GetLocationActions(int currentTime, int locationIndex, Character player)
    {
        List <Action> actions = new List <Action>();

        if (toggleAllowed)
        {
            string       toggleText   = isBurning ? "Turn Oven Off" : "Turn Oven On";
            ActionToggle actionToggle = new ActionToggle(currentTime, toggleText, this);
            actions.Add(actionToggle);
        }

        bool freeSpace = false;

        for (int i = 0, length = itemsInside.Length; i < length; i++)
        {
            Item item = itemsInside[i];
            if (item == null)
            {
                freeSpace = true;
            }
            else
            {
                ActionRecover actionRecover = new ActionRecover(currentTime, "Take " + item.ToShortString() + " from Oven", item, i, this, locationIndex);
                actions.Add(actionRecover);
            }
        }

        if (freeSpace)
        {
            for (int i = 0, count = player.inventory.Count; i < count; i++)
            {
                Item item = player.inventory[i];
                //TODO, maybe allow the oven to filter somehow, this currently allows placing ingredients in oven
//				if(item.GetType() == typeof(Cake))
                {
                    ActionPlace actionPlace = new ActionPlace(currentTime, "Place " + item.ToShortString() + " in Oven", item, i, this, locationIndex);
                    actions.Add(actionPlace);
                }
            }
        }

        return(actions.ToArray());
    }
示例#2
0
    public override Action[] GetLocationActions(int currentTime, int locationIndex, Character player)
    {
        List <Action> actions = new List <Action>();

        bool freeSpace = false;

        for (int i = 0, length = itemsInside.Length; i < length; i++)
        {
            Item item = itemsInside[i];
            if (item == null)
            {
                freeSpace = true;
            }
            else
            {
                ActionRecover actionRecover = new ActionRecover(currentTime, "Detach " + item.ToString() + " from Car", item, i, this, locationIndex);
                actions.Add(actionRecover);
            }
        }

        if (freeSpace)
        {
            for (int i = 0, count = player.inventory.Count; i < count; i++)
            {
                Wheel wheel = player.inventory[i] as Wheel;

                if (wheel != null)
                {
                    ActionPlace actionPlace = new ActionPlace(currentTime, "Attach " + wheel.ToString() + " to Car", wheel, i, this, locationIndex);
                    actions.Add(actionPlace);
                }
            }
        }

        return(actions.ToArray());
    }
示例#3
0
    public override Action[] GetLocationActions(int currentTime, int locationIndex, Character character)
    {
        List <Action> actions = new List <Action>();
        Key           key     = Utils.FindItemOfType <Key>(character.inventory);

        if (locked)
        {
            if (key != null)
            {
                ActionUse actionUse = new ActionUse(currentTime, "Unlock " + this.GetType(), key, this);
                actions.Add(actionUse);
            }
        }
        else
        {
            if (key != null)
            {
                ActionUse actionUse = new ActionUse(currentTime, "Lock " + this.GetType(), key, this);
                actions.Add(actionUse);
            }

            //TODO, this is a good start for handling box content through timeline
            if (GameManager.Instance.itemTimeline.characters[0].timeline.Count > 0)
            {
                ItemEntry itemEntry = GameManager.Instance.itemTimeline.GetLatestFixedEntry(currentTime, age, locationIndex);

                Box previousBox = itemEntry.item as Box;

                if (previousBox != null)
                {
                    //Debug.Log(previousBox.ToString() +", "+locationIndex);
                }
            }

            bool freeSpace = false;
            for (int i = 0, length = itemsInside.Length; i < length; i++)
            {
                Item item = itemsInside[i];
                if (item == null)
                {
                    freeSpace = true;
                }
                else
                {
                    ActionRecover actionRecover = new ActionRecover(currentTime, "Take " + item.ToString() + " from Box " + age, item, i, this, locationIndex);
                    actions.Add(actionRecover);
                }
            }

            if (freeSpace)
            {
                for (int i = 0, count = character.inventory.Count; i < count; i++)
                {
                    Item item = character.inventory[i];

                    if (item is Box == false)
                    {
                        ActionPlace actionPlace = new ActionPlace(currentTime, "Place " + item.ToString() + " in Box " + age, item, i, this, locationIndex);
                        actions.Add(actionPlace);
                    }
                }
            }
        }

        return(actions.ToArray());
    }