コード例 #1
0
 void Update()
 {
     LockstepManager.Visualize();
     if (Input.GetKeyDown(KeyCode.Space))
     {
         LSAgent temp = controller.CreateAgent(AgentCode.Minion);
         //temp.Body.Parent = agent.Body;
     }
 }
コード例 #2
0
 public static void Initialize()
 {
     if (Loaded == false)
     {
         LSDatabase database = LSFSettingsManager.GetSettings().Database;
         _currentDatabase = database;
         Loaded           = true;
         LockstepManager.Setup();
     }
     Terrain = GameObject.FindObjectOfType <Terrain> ();
 }
コード例 #3
0
    void Start()
    {
        LockstepManager.Initialize();
        AgentController controller = AgentController.Create();

        for (int i = 0; i < 256; i++)
        {
            controller.CreateAgent(AgentCode.Footman);
        }
        PlayerManager.AddAgentController(controller);
    }
コード例 #4
0
    public override void OnInspectorGUI()
    {
        AllAgentCodes        = (AgentCode[])Enum.GetValues(typeof(AgentCode));
        TitleStyle.fontStyle = FontStyle.Bold;
        LockstepManager Target = (LockstepManager)target;

        EditorGUI.BeginChangeCheck();

        Target.SelectionRing = (GameObject)EditorGUILayout.ObjectField("Selection Ring Object", Target.SelectionRing, typeof(GameObject), false);

        #region AgentObjects
        ShowAgentObjects = EditorGUILayout.Foldout(ShowAgentObjects, "Spawnable Agents");

        if (ShowAgentObjects)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(15f);
            EditorGUILayout.BeginVertical();
            if (Target.AgentObjects.Length != AllAgentCodes.Length)
            {
                Array.Resize(ref Target.AgentObjects, AllAgentCodes.Length);
            }

            for (int i = 0; i < AllAgentCodes.Length; i++)
            {
                GameObject go = (GameObject)EditorGUILayout.ObjectField(
                    AllAgentNames [i],
                    Target.AgentObjects [i],
                    typeof(GameObject),
                    false);
                if (go != null && go.GetComponent <LSAgent> () == null)
                {
                    Debug.LogError(go + " does not have the LSAgent component attached and cannot be created.");
                    continue;
                }
                Target.AgentObjects [i] = go;
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }

        #endregion
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
            //EditorUtility.SetDirty (target);
        }
    }
コード例 #5
0
	protected override void OnLateSimulate()
	{
		if (ReplayManager.IsPlayingBack)
		{
			if (!FrameManager.CanAdvanceFrame)
			{
				long newHash = LockstepManager.GetStateHash();
				if (newHash != ReplayManager.CurrentReplay.hash)
				{
					Debug.Log("Desynced!");
				}
				else
				{
					Debug.Log("Synced!");
				}
			}
		}
	}
コード例 #6
0
    void Start()
    {
        LockstepManager.Initialize();
        GridManager.Generate();
        const int count = 32;


        for (int i = -count; i < count; i++)
        {
            for (int j = -count; j < count; j++)
            {
                if (i * i + j * j < 16)
                {
                    continue;
                }
                if (LSUtility.GetRandom(2) == 0)
                {
                    Vector2d pos = new Vector2d(i, j);
                    GridManager.GetNode(pos.x, pos.y).Unwalkable = true;
                    Instantiate(TestWall).GetComponent <LSBody>().Initialize(pos);
                }
            }
        }

        /*LSBody wall = Instantiate (TestWall).GetComponent<LSBody> ();
         * wall.Initialize (new Vector2d (-32 + 14, 0));
         * for (long i = wall.XMin; i <= wall.XMax; i+= FixedMath.One) {
         *      for (long j = wall.YMin; j <= wall.YMax; j+= FixedMath.One) {
         *              GridManager.GetNode (i, j).Unwalkable = true;
         *      }
         * }*/

        GridManager.Initialize();
        controller = AgentController.Create();
        for (int i = 0; i < 256; i++)
        {
            agent = controller.CreateAgent(AgentCode.Minion);
        }
        PlayerManager.AddAgentController(controller);
    }
コード例 #7
0
 void FixedUpdate()
 {
     LockstepManager.Simulate();
 }
コード例 #8
0
 private void Awake()
 {
     _instance = this;
 }
コード例 #9
0
 void Update()
 {
     LockstepManager.Visualize();
 }