コード例 #1
0
 public bool isStepFinished()
 {
     StatusCheckable[] s = new StatusCheckable[statuses.Keys.Count];
     statuses.Keys.CopyTo(s, 0);
     for (int i = 0; i < s.Length; i++)
     {
         bool test;
         statuses.TryGetValue(s[i], out test);
         if (!test)
         {
             return(false);
         }
         else
         {
             if (s[i].GetType().Equals(typeof(ActionCheckable)))
             {
                 ActionCheckable ac = ((ActionCheckable)s[i]);
                 if (spawnLocations.Count == commands.Count && commands.Count > 0 && (ac.getRequiredAction().getActionType() == ActionType.KILL || ac.getRequiredAction().getActionType() == ActionType.PICKED_UP_OBJECT))
                 {
                     WorldMap.RemoveStarAt(spawnLocations[i].x, spawnLocations[i].y);
                 }
             }
         }
     }
     return(true);
 }
コード例 #2
0
        public void updateStatusChecks(IAction action)
        {
            StatusCheckable[] stats = new StatusCheckable [statuses.Keys.Count];
            statuses.Keys.CopyTo(stats, 0);

            //go through all the current status checks
            foreach (StatusCheckable a in stats)
            {
                bool done = false;
                statuses.TryGetValue(a, out done);

                //if the status check is not saved as done, then
                //see if it has recently been satisfied, if it has,
                //then save that, otherwise, we may not step state,
                //so return
                if (!done)
                {
                    if (a.isStatusMet(action))
                    {
                        Debug.Log("Action Met: " + this.name);
                        if (this.name.Equals("See the World") && CityHelp.helpMode == -1)
                        {
                            CityHelp.helpMode = 4;
                        }
                        statuses.Remove(a);
                        statuses.Add(a, true);
                    }
                }
            }
        }
コード例 #3
0
ファイル: ConversationNode.cs プロジェクト: yazici/ProcGenRPG
    public void initFromProto(ConversationNode proto)
    {
        alternatives = new Dictionary <long, Alternative>();
        blocks       = new List <StatusBlock>();
        if (proto.Name != "null")
        {
            ID = proto.Name;
        }
        else
        {
            ID = "" + uid;
        }

        if (proto.Text != "null")
        {
            text = proto.Text;
        }
        else
        {
            text = "";
        }

        foreach (Connection c in proto.ConnectionsList)
        {
            List <List <StatusCheckable> > reqs = new List <List <StatusCheckable> >();

            foreach (RequirementSet block in c.RequirementSetsList)
            {
                StatusCheckableFactory factory = new StatusCheckableFactory();
                List <StatusCheckable> checks  = new List <StatusCheckable>();
                foreach (StatusCheckableProtocol p in block.RequirementsList)
                {
                    StatusCheckable check = factory.getStatusCheckableFromProtocol(p);
                    check.setActive();
                    checks.Add(check);
                }
                reqs.Add(checks);
            }

            Alternative alt = new Alternative(c.NodeId, c.Text, reqs);

            if (c.HasPriority)
            {
                alt.setPriority(c.Priority);
            }
            else
            {
                alt.setPriority(0);
            }
            alternatives.Add(alt.getUID(), alt);
        }

        foreach (StatusBlockProtocol s in proto.BlocksList)
        {
            Debug.Log("LOADING: " + this.text);
            StatusBlock block = new StatusBlock(s);

            foreach (StatusCheckable check in block.getStatuses())
            {
                check.setActive();
            }

            blocks.Add(block);
        }

        strIdMap.Add(ID, this);
    }