Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>10.0.20506</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<RootNamespace></RootNamespace> | ||
<ProjectGuid>{8BDBDF9F-FEF3-7D2C-8E29-2D8DF4A1F275}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<AssemblyName>Assembly-CSharp</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<BaseDirectory>Assets</BaseDirectory> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>Temp\bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_4_0;UNITY_5_4;UNITY_5;UNITY_64;ENABLE_NEW_BUGREPORTER;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_EDITOR_RETINA;ENABLE_RETINA_GUISTYLES;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_SPRITE_POLYGON;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_LOCALIZATION;ENABLE_ANDROID_ATLAS_ETC1_COMPRESSION;ENABLE_EDITOR_TESTS_RUNNER;UNITY_STANDALONE_OSX;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_GAMECENTER;ENABLE_TEXTUREID_MAP;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLUSTERINPUT;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_OSX;UNITY_TEAM_LICENSE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>Temp\bin\Release\</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<NoWarn>0169</NoWarn> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.XML" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEditor"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/Managed/UnityEditor.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Assets\Buildings\Building.cs" /> | ||
<Compile Include="Assets\Buildings\Buildings.cs" /> | ||
<Compile Include="Assets\Buildings\Capacitor\Capacitor.cs" /> | ||
<Compile Include="Assets\Buildings\WarFactory\WarFactory.cs" /> | ||
<Compile Include="Assets\Player\Player.cs" /> | ||
<Compile Include="Assets\Units\Tank\Tank.cs" /> | ||
<Compile Include="Assets\Units\Tank\TankProjectile.cs" /> | ||
<Compile Include="Assets\Units\Unit.cs" /> | ||
<Compile Include="Assets\Units\Units.cs" /> | ||
<Compile Include="Assets\Units\Worker\Worker.cs" /> | ||
<Compile Include="Assets\_Scripts\Ammo.cs" /> | ||
<Compile Include="Assets\_Scripts\Builder.cs" /> | ||
<Compile Include="Assets\_Scripts\ButtonPanel.cs" /> | ||
<Compile Include="Assets\_Scripts\Detection.cs" /> | ||
<Compile Include="Assets\_Scripts\GameObjectList.cs" /> | ||
<Compile Include="Assets\_Scripts\HUD.cs" /> | ||
<Compile Include="Assets\_Scripts\Projectile.cs" /> | ||
<Compile Include="Assets\_Scripts\RTS\Enums.cs" /> | ||
<Compile Include="Assets\_Scripts\RTS\ResourceManager.cs" /> | ||
<Compile Include="Assets\_Scripts\RTS\SortedSet.cs" /> | ||
<Compile Include="Assets\_Scripts\RTS\WorkManager.cs" /> | ||
<Compile Include="Assets\_Scripts\RTSButton.cs" /> | ||
<Compile Include="Assets\_Scripts\RTSObject.cs" /> | ||
<Compile Include="Assets\_Scripts\SelectObject.cs" /> | ||
<Compile Include="Assets\_Scripts\TeamColor.cs" /> | ||
<Compile Include="Assets\_Scripts\UserInput.cs" /> | ||
<Reference Include="UnityEngine.Networking"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
|
||
</Project> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using RTS; | ||
|
||
public class Building : RTSObject { | ||
public Unit[] buildableUnits; | ||
private Dictionary<string, Unit> units; | ||
public float maxBuildProgress; | ||
protected Queue< Unit > buildQueue; | ||
private float currentBuildProgress = 0.0f; | ||
private Vector3 spawnPoint; | ||
private bool needsBuilding; | ||
|
||
|
||
public int startBelow; | ||
private Vector3 startSpawnPoint; | ||
public Vector3 endSpawnPoint; | ||
|
||
private float currentTime = 0.0f; | ||
public bool constructing; | ||
|
||
|
||
protected override void Awake() { | ||
base.Awake(); | ||
Debug.Log (objectName); | ||
buildQueue = new Queue< Unit >(); | ||
float spawnX = selectionBounds.center.x + transform.forward.x * selectionBounds.extents.x + transform.forward.x * 10; | ||
float spawnZ = selectionBounds.center.z + transform.forward.z + selectionBounds.extents.z + transform.forward.z * 10; | ||
spawnPoint = new Vector3 (spawnX, 0.0f, spawnZ); | ||
units = new Dictionary<string, Unit> (); | ||
for (int i = 0; i < buildableUnits.Length; i++) { | ||
Unit buildableUnit = buildableUnits [i]; | ||
units.Add (buildableUnit.objectName, buildableUnit); | ||
} | ||
endSpawnPoint = transform.position; | ||
transform.position = new Vector3(transform.position.x, startBelow, transform.position.z); | ||
constructing = true; | ||
startSpawnPoint = transform.position; | ||
} | ||
|
||
protected override void Start () { | ||
base.Start(); | ||
|
||
|
||
} | ||
|
||
protected override void Update () { | ||
base.Update(); | ||
if (!constructing) { | ||
ProcessBuildQueue (); | ||
} else { | ||
Construct (); | ||
} | ||
|
||
} | ||
|
||
protected override void OnGUI() { | ||
base.OnGUI(); | ||
} | ||
|
||
protected void CreateUnit(string unitName) { | ||
if (units.ContainsKey(unitName)) { | ||
buildQueue.Enqueue(units[unitName]); | ||
Debug.Log (unitName); | ||
} | ||
} | ||
protected void ProcessBuildQueue() { | ||
if(buildQueue.Count > 0) { | ||
maxBuildProgress = buildQueue.Peek ().buildTime; | ||
currentBuildProgress += Time.deltaTime * ResourceManager.BuildSpeed; | ||
if(currentBuildProgress >= maxBuildProgress) { | ||
InstantiateUnit (); | ||
currentBuildProgress = 0.0f; | ||
} | ||
} | ||
} | ||
protected virtual void InstantiateUnit() { | ||
if(player) player.AddUnit(buildQueue.Dequeue(), spawnPoint, transform.rotation); | ||
} | ||
public string[] getBuildQueueValues() { | ||
string[] values = new string[buildQueue.Count]; | ||
int pos=0; | ||
foreach(Unit unit in buildQueue) values[pos++] = unit.objectName; | ||
return values; | ||
} | ||
|
||
public float getBuildPercentage() { | ||
return currentBuildProgress / maxBuildProgress; | ||
} | ||
public void StartConstruction() { | ||
CalculateBounds(); | ||
needsBuilding = true; | ||
hitPoints = 0; | ||
} | ||
|
||
public bool UnderConstruction() { | ||
return needsBuilding; | ||
} | ||
|
||
protected void Construct () { | ||
if (constructing) { | ||
if (transform.position == endSpawnPoint) { | ||
constructing = false; | ||
} else { | ||
currentTime += Time.deltaTime; | ||
float timeRatio = currentTime / buildTime; | ||
transform.position = Vector3.Lerp (startSpawnPoint, endSpawnPoint, timeRatio); | ||
|
||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class Buildings : MonoBehaviour { | ||
//wrapper class for unit listing for a player | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
using RTS; | ||
public class Capacitor : Building { | ||
|
||
public int addedCapacitanceLimit; | ||
public Vector3 center; | ||
public float radius; | ||
private float angle; | ||
public int maxWorkers; | ||
private int currentworkers; | ||
private Vector3 currentpoint; | ||
private float step; | ||
protected override void Awake() { | ||
base.Awake (); | ||
|
||
|
||
} | ||
|
||
protected override void Start () { | ||
base.Start (); | ||
player.addResourceLimit (ResourceType.Capacitance, addedCapacitanceLimit); | ||
center = transform.position; | ||
step = 2 * Mathf.PI / maxWorkers; | ||
angle = 0; | ||
currentworkers = transform.childCount; | ||
currentpoint = new Vector3 (center.x + radius, center.y, center.z + radius); | ||
CreateUnit ("Worker"); | ||
CreateUnit ("Worker"); | ||
CreateUnit ("Worker"); | ||
CreateUnit ("Worker"); | ||
CreateUnit ("Worker"); | ||
CreateUnit ("Worker"); | ||
} | ||
|
||
protected override void Update () { | ||
base.Update (); | ||
if (!constructing) { | ||
} | ||
} | ||
|
||
protected override void OnGUI() { | ||
base.OnGUI (); | ||
} | ||
protected override void OnDestroy() { | ||
player.addResourceLimit (ResourceType.Capacitance, addedCapacitanceLimit * -1); | ||
} | ||
|
||
public void addResource(ResourceType resourceName, int value) { | ||
player.addResource (resourceName, value); | ||
} | ||
public void addResourceLimit (ResourceType resourceName, int value) { | ||
player.addResourceLimit (resourceName, value); | ||
} | ||
protected override void InstantiateUnit() { | ||
if (currentworkers < maxWorkers) { | ||
angle += step; | ||
Vector3 offset = new Vector3 (Mathf.Sin (angle) * radius, 0, Mathf.Cos (angle) * radius); | ||
currentpoint = center + offset; | ||
Unit newUnit = Instantiate (buildQueue.Dequeue (), currentpoint, transform.rotation) as Unit; | ||
newUnit.transform.parent = this.transform; | ||
currentworkers++; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class WarFactory : Building { | ||
|
||
|
||
protected override void Start () { | ||
base.Start(); | ||
} | ||
|
||
protected override void Update() { | ||
base.Update (); | ||
} | ||
protected override void InstantiateUnit() { | ||
base.InstantiateUnit (); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.