示例#1
0
        void Start()
        {
            var spawnNode = new SpawnNode();


            spawnNode.Add(DelayAction.Allocate(1.0f, () => Debug.Log(Time.time)));
            spawnNode.Add(DelayAction.Allocate(1.0f, () => Debug.Log(Time.time)));
            spawnNode.Add(DelayAction.Allocate(1.0f, () => Debug.Log(Time.time)));
            spawnNode.Add(DelayAction.Allocate(1.0f, () => Debug.Log(Time.time)));
            spawnNode.Add(DelayAction.Allocate(1.0f, () => Debug.Log(Time.time)));

            this.ExecuteNode(spawnNode);
        }
示例#2
0
    //[UnityTest]
    public IEnumerator SpawnNodeTest()
    {
        var stopwatch = new Stopwatch();

        stopwatch.Start();

        var spawnNode = new SpawnNode();

        spawnNode.Add(DelayAction.Allocate(1, () => {  }));
        spawnNode.Add(DelayAction.Allocate(1, () => {  }));
        spawnNode.Add(DelayAction.Allocate(1, () => { stopwatch.Stop(); }));

        while (!spawnNode.Execute(Time.deltaTime))
        {
            yield return(null);
        }
        Debug.Log(stopwatch.ElapsedMilliseconds);
    }
示例#3
0
    /// <summary> Spawns a "spawn" node with given parameters </summary>
    /// <param name="types"> array with the types of the spawn commands </param>
    /// <param name="names"> array with the names of the spawn commands </param>
    public void Spawn_SpawnNode(string[] types, string[] names)
    {
        SpawnNode node = Instantiate(spawn_template).GetComponent <SpawnNode>();

        node.Start_();
        Add(node);
        for (int i = 0; i < types.Length; i++)
        {
            node.Add(new SpawnInst(names[i], types[i]));
        }
    }