Ejemplo n.º 1
0
        public void Copy(BehaviourObject _object)
        {
            if (_object == null)
            {
                return;
            }

            base.Copy(_object);

            BehaviourModes.Clear();
            foreach (BehaviourModeObject _mode in _object.BehaviourModes)
            {
                BehaviourModes.Add(new BehaviourModeObject(_mode));
            }
        }
Ejemplo n.º 2
0
                /// <summary>
                /// Saves the behaviour to file.
                /// </summary>
                /// <param name="status">Status.</param>
                public static void SaveBehaviourToFile(BehaviourObject behaviour, string owner)
                {
                    path = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Behaviour File As", owner.ToLower() + ".cc_behaviours", "cc_behaviours", "");

                    if (path.Length == 0)
                    {
                        return;
                    }

                    XmlSerializer serializer = new XmlSerializer(typeof(BehaviourObject));
                    FileStream    stream     = new FileStream(path, FileMode.Create);

                    serializer.Serialize(stream, behaviour);
                    stream.Close();
                }
Ejemplo n.º 3
0
                /// <summary>
                /// Loads the behaviour from file.
                /// </summary>
                /// <returns>The behaviour from file.</returns>
                /// <param name="behaviour">Behaviour.</param>
                public static BehaviourObject LoadBehaviourFromFile(BehaviourObject behaviour)
                {
                    path = UnityEditor.EditorUtility.OpenFilePanel("Open Behaviour File", Application.dataPath, "cc_behaviours");

                    if (path.Length == 0)
                    {
                        return(behaviour);
                    }

                    XmlSerializer serializer = new XmlSerializer(typeof(BehaviourObject));
                    FileStream    stream     = new FileStream(path, FileMode.Open);

                    behaviour = serializer.Deserialize(stream) as BehaviourObject;
                    stream.Close();

                    return(behaviour);
                }
Ejemplo n.º 4
0
        public override void Reset()
        {
            if (Application.isPlaying)
            {
                //Debug.Log( "Creature.Reset: " + OwnerName );

                Status.Reset();
                Behaviour.Reset();
                Move.Reset();

                m_ActiveTarget = null;

                Essentials.Target.Reset();
                Missions.Outpost.Target.Reset();
                Missions.Escort.Target.Reset();

                if (Missions.Patrol.Target != null)
                {
                    Missions.Patrol.Target.Reset();
                }

                // PREDECISIONS INTERACTORS
                foreach (InteractorObject _interactor in Interaction.Interactors)
                {
                    _interactor.Reset();
                    foreach (TargetObject _target in _interactor.PreparedTargets)
                    {
                        _target.Reset();
                    }
                }
            }
            else
            {
                m_Interaction = new InteractionObject(OwnerComponent);
                m_Essentials  = new EssentialsObject(OwnerComponent);
                m_Status      = new StatusObject(OwnerComponent);
                m_Behaviour   = new BehaviourObject(OwnerComponent);
                m_Missions    = new MissionsObject(OwnerComponent);
                m_Move        = new MoveObject(OwnerComponent);
                m_Environment = new EnvironmentObject(OwnerComponent);
            }
        }
Ejemplo n.º 5
0
 public BehaviourObject(BehaviourObject _object) : base(_object)
 {
     Copy(_object);
 }