コード例 #1
0
    public static Bullet Spawn(Vector3 position, Vector2 direction, float timer, float speed)
    {
        tmpBullet = null;
        for (int i = 0; i < pool.Count; i++)
        {
            if (!pool[i].isActiveAndEnabled)
            {
                tmpBullet = pool[i];
                tmpBullet.gameObject.SetActive(true);
                break;
            }
        }

        if (tmpBullet == null)
        {
            tmpBullet = Instantiate(PrefabManager.Current.BulletPrefab);
            pool.Add(tmpBullet);
        }

        tmpBullet.transform.position = position;
        tmpBullet.Timer = timer;
        WrappingWorld.Register(tmpBullet);
        tmpBullet._rb.velocity = direction * speed;
        tmpBullet.hit          = false;
        return(tmpBullet);
    }
コード例 #2
0
    public static FuelTree Spawn(string id, Vector3 position, int fuels)
    {
        tmpTree = null;
        for (int i = 0; i < pool.Count; i++)
        {
            if (!pool[i].isActiveAndEnabled)
            {
                tmpTree = pool[i];
                tmpTree.gameObject.SetActive(true);
                break;
            }
        }

        if (tmpTree == null)
        {
            tmpTree = Instantiate(PrefabManager.Current.FuelTreePrefab);
            pool.Add(tmpTree);
        }

        tmpTree.transform.position     = position;
        tmpTree.LoadedObjectDefinition = id;
        tmpTree.Fuels = fuels;
        WrappingWorld.Register(tmpTree);
        return(tmpTree);
    }
コード例 #3
0
    public static void SwitchToWorld(WorldGenerator.WorldDefinition world)
    {
        PlayerCharacter.Current.gameObject.SetActive(true);

        for (int i = 0; i < WorldCameras.Count; i++)
        {
            WorldCameras[i].SetActive(true);
        }

        for (int i = 0; i < SpaceCameras.Count; i++)
        {
            SpaceCameras[i].SetActive(false);
        }

        CurrentState = GameMode.PlanetPlaying;
        WrappingWorld.ResetWorld();
        PlayerCharacter.Current.ResetWorld();
        WrappingWorld.Current.LoadWorld(world);
    }
コード例 #4
0
 public static void Despawn(Bullet bullet)
 {
     bullet.gameObject.SetActive(false);
     WrappingWorld.Deregister(bullet);
 }
コード例 #5
0
 public void Awake()
 {
     Current = this;
 }