Beispiel #1
0
 //constructors
 private RRLine()
 {
     _voidFuncs = new List <ActionVoid>();
     _moveFunc  = null;
     _useFunc   = null;
     Activated  = false;
 }
Beispiel #2
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());
    }
Beispiel #3
0
 public RRLine(ActionUse usefunc) : this()
 {
     _useFunc = usefunc;
 }
Beispiel #4
0
 public ConLine(ActionUse usefunc, ConToken preset) : base(usefunc)
 {
     _preset = preset;
 }