コード例 #1
0
        public void SpawnNextTrapObjectPrefab()
        {                        //usually called as an animation event
            LastTrapObjectPrefabSpawnPointIndex = TrabObjectPrefabSpawnPoints.NextIndex(LastTrapObjectPrefabSpawnPointIndex);
            Transform  spawnPoint = TrabObjectPrefabSpawnPoints[LastTrapObjectPrefabSpawnPointIndex];
            GameObject trapObject = GameObject.Instantiate(TrapObjectPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;
            TrapObject tr         = (TrapObject)trapObject.GetOrAdd("Frontiers.World.Gameplay." + State.TrapObjectScript);

            tr.ParentTrap = this;
        }
コード例 #2
0
    public IEnumerator SpawnObjects()
    {
        for (;;)
        {
            TrapObject ob = Instantiate(SpawnObject, transform.position, transform.rotation);
            ob.SetVelocity(ProjectileSpeed, transform.forward);
            ob.SetDestroyTimer(ObjectLifeSpan);

            // Debug.Log("Spawned object");

            yield return(new WaitForSeconds(SpawnDelay));
        }
    }