Commit 79ac8bbe by Naliwe GS

Basics

parent 50ff4538
fileFormatVersion: 2
guid: 22e0d8b57f789ce49ba2a2adae9dadec
folderAsset: yes
timeCreated: 1469997140
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 02bdda2559eb6e0478bba7e6b8aa88fb
timeCreated: 1469997363
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2632aef584ea8314299444ce97d7f32c
timeCreated: 1469997168
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1a5b4426128661346a5fcfc7f0b388e7
folderAsset: yes
timeCreated: 1469996963
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f3f15d4f7beb8af49adebe524bed6179
timeCreated: 1469997332
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 534578d7e4746704894da74561f7198e
timeCreated: 1469996969
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a0438dee19db39d4f8e47a6a83709b0e
timeCreated: 1469997714
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
using Assets.Scripts.Utils;
using UnityEngine;
namespace Assets.Scripts
{
public class GameController : MonoBehaviour
{
public static int PoolSize = 256;
private ObjectPool _pooledWalls;
private ObjectPool _pooledActors;
private ObjectPool _pooledProjectiles;
void Start()
{
_pooledActors = new ObjectPool(PoolSize);
_pooledProjectiles = new ObjectPool(PoolSize);
_pooledWalls = new ObjectPool(PoolSize);
}
void Update()
{
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
}
using UnityEngine;
namespace Assets.Scripts
{
public class Player : MonoBehaviour
{
private Transform _pos;
void Start()
{
_pos = GetComponent<Transform>();
}
void Update()
{
var newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
newPos.z = 0;
_pos.position = Vector3.Lerp(_pos.position, newPos, 10 * Time.deltaTime);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: ac12067f081e1bb4a9a576053cf23b44
timeCreated: 1469997725
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 0c4600f713b2c5f48800d11accf9a99f
folderAsset: yes
timeCreated: 1469993544
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Assets.Scripts.Utils
{
public class ObjectPool
{
public GameObject PooledObject;
public List<GameObject> Pool;
public bool WillGrow;
public int Size;
public ObjectPool(int size)
{
Size = size;
}
public void Start()
{
Pool = new List<GameObject>();
for (var i = 0; i < Pool.Count; i++)
{
var obj = Object.Instantiate(PooledObject);
obj.SetActive(false);
Pool.Add(obj);
}
}
public GameObject GetPooledObject()
{
if (!WillGrow || !Pool.All(o => o.activeInHierarchy))
return Pool.FirstOrDefault(o => !o.activeInHierarchy);
var obj = Object.Instantiate(PooledObject);
Pool.Add(obj);
return obj;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 573af60f153c3c5428fc5363ab81d909
timeCreated: 1469996348
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment