Skip to content

Commit

Permalink
Merge pull request #75 from Bojzen-I-Mitten/gameplay/master
Browse files Browse the repository at this point in the history
Gameplay/master
  • Loading branch information
morgan-cromell authored Oct 4, 2018
2 parents fe6595c + c7cdab8 commit a2db9c5
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Concussion Ball/Assets/SSP/Assets/Chad.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<d3p1:force>5</d3p1:force>
<d3p1:hand z:Ref="18" i:nil="true" />
<d3p1:speed>5</d3p1:speed>
<d3p1:throwForce>10</d3p1:throwForce>
<d3p1:throwForce>5</d3p1:throwForce>
</Component>
<Component z:Id="25" xmlns:d3p1="http://schemas.datacontract.org/2004/07/ThomasEngine.Network" i:type="d3p1:NetworkIdentity">
<m_guid>d8901bcb-c5fd-4e92-87f1-82c23631c16a</m_guid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,22 @@
public class Ball : NetworkComponent
{
Rigidbody rb;
bool pickedUp { get { return !rb.enabled; } set { rb.enabled = !value; } }
RenderComponent rc;
bool pickedUp { get { return !rb.enabled; } set { rb.enabled = !value; } }
private float accumulator;
private float chargeupTime;

private float interp = 0;

public override void Start()
{
chargeupTime = 4.0f;
accumulator = 0.0f;
rb = gameObject.GetComponent<Rigidbody>();
rc = gameObject.GetComponent<RenderComponent>();


rc.material.SetColor("color", new Color(0, 0, 255));
//visualizer = Object.GetObjectsOfType<ThrowStrengthVisualizer>()[0];
}

Expand All @@ -31,13 +42,34 @@ public void Drop()

}

public void ChargeColor(float throwForce)
{
//Debug.Log("Red: " + rc.material.GetColor("color").r);

accumulator += Time.DeltaTime;
interp = accumulator / chargeupTime;

float value = interp;

Color newColor = new Color(value, 0.0f, (1.0f-interp));

rc.material.SetColor("color", newColor);

}

public void Throw(Vector3 force)
{
if (pickedUp)
{
Drop();
transform.position = transform.position + Vector3.Normalize(force) * 2;
rb.AddForce(force, Rigidbody.ForceMode.Impulse);

rc.material.SetColor("color", new Color(0, 0, 255));

// Reset values
accumulator = 0;
interp = 0.0f;
}
}

Expand All @@ -51,7 +83,6 @@ public void Pickup(GameObject gobj, Transform hand)
public override void OnLostOwnership()
{
rb.enabled = false;
pickedUp = true;
}

public override void OnRead(NetPacketReader reader, bool initialState)
Expand Down
File renamed without changes.
File renamed without changes.
28 changes: 16 additions & 12 deletions Concussion Ball/Assets/Scripts/chadControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ namespace ThomasEditor
public class ChadControls : NetworkComponent
{


public float baseThrowForce { get; set; } = 5.0f;
public float maxThrowForce { get; set; } = 20.0f;

public int speed { get; set; } = 5;
public float force { get; set; } = 5;
public float cameraSensitivity { get; set; } = 1;
public float cameraDistance { get; set; } = 2;

public float throwForce { get; set; }
private float throwForce;

public Transform hand { get; set; }

Expand Down Expand Up @@ -57,7 +58,7 @@ public override void Start()
Debug.LogWarning("Camera not set for player");

rBody.IsKinematic = !isOwner;

throwForce = baseThrowForce;
ball = Object.GetObjectsOfType<Ball>().FirstOrDefault();
}

Expand Down Expand Up @@ -137,16 +138,19 @@ public void HandleMovement()

public void FondleBall()
{
if(Input.GetMouseButtonDown(Input.MouseButtons.LEFT))
if(Input.GetMouseButton(Input.MouseButtons.LEFT) && throwForce < maxThrowForce)
{
if(hand && camera)
{
hasBall = false;

ball.Throw(camera.transform.forward * throwForce);

}

throwForce += 5.0f * Time.DeltaTime;
if (throwForce > 19)
Debug.Log("Current throw force: " + (int)throwForce);
ball.ChargeColor(throwForce);
}
if (hand && camera && Input.GetMouseButtonUp(Input.MouseButtons.LEFT))
{
hasBall = false;

ball.Throw(camera.transform.forward * throwForce);
throwForce = baseThrowForce;
}
}

Expand Down
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions Concussion Ball/Assets/YaBoll.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Material xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="http://schemas.datacontract.org/2004/07/ThomasEngine">
<asset_path z:Id="2">%THOMAS_ASSETS%\YaBoll.mat</asset_path>
<Shader z:Id="3">
<path z:Id="4">%THOMAS_DATA%\FXIncludes\StandardShader.fx</path>
</Shader>
<EditorProperties xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" z:Id="5" z:Size="5">
<d2p1:KeyValueOfstringanyType>
<d2p1:Key z:Id="6">color</d2p1:Key>
<d2p1:Value z:Id="7" i:type="Color">
<a>255</a>
<b>255</b>
<g>255</g>
<r>255</r>
</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key z:Id="8">diffuseTex</d2p1:Key>
<d2p1:Value z:Id="9" i:type="SceneResource">
<path z:Id="10">White Texture</path>
</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key z:Id="11">normalTex</d2p1:Key>
<d2p1:Value z:Id="12" i:type="SceneResource">
<path z:Id="13">Normal Texture</path>
</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key z:Id="14">smoothness</d2p1:Key>
<d2p1:Value z:Id="15" xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:float">16</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key z:Id="16">specularTex</d2p1:Key>
<d2p1:Value z:Id="17" i:type="SceneResource">
<path z:Id="18">White Texture</path>
</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
</EditorProperties>
</Material>
2 changes: 1 addition & 1 deletion Concussion Ball/Assets/asd.mat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Material xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="http://schemas.datacontract.org/2004/07/ThomasEngine">
<asset_path z:Id="2">StandardShader Material.mat</asset_path>
<asset_path z:Id="2">%THOMAS_ASSETS%\asd.mat</asset_path>
<Shader z:Id="3">
<path z:Id="4">%THOMAS_DATA%\FXIncludes\StandardShader.fx</path>
</Shader>
Expand Down
143 changes: 143 additions & 0 deletions Concussion Ball/Assets/iSpyISpyWithMyLittleEye.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<GameObject xmlns:i="http://www.w3.org/2001/XMLSchema-instance" z:Id="1" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" xmlns="http://schemas.datacontract.org/2004/07/ThomasEngine">
<m_guid>b315c6fb-a472-4d2f-9b41-3344d8dd86bb</m_guid>
<m_name z:Id="2">iSpyISpyWithMyLittleEye</m_name>
<Components z:Size="2">
<Component z:Id="3" i:type="Transform">
<m_guid>c455b314-3283-4fa4-b911-4b185742129f</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Ref="1" i:nil="true" />
<children z:Size="0" />
<localEulerAngles>
<x>0</x>
<y>0</y>
<z>-0</z>
</localEulerAngles>
<localPosition>
<x>0</x>
<y>0.999274731</y>
<z>2.94460964</z>
</localPosition>
<localScale>
<x>1</x>
<y>1</y>
<z>1</z>
</localScale>
<parent z:Id="4">
<m_guid>5f896d9f-d0fc-4559-b4a1-be408158c946</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Id="5">
<m_guid>0f2b5618-89d3-45b1-964d-204f3a788645</m_guid>
<m_name z:Id="6">enSvensk</m_name>
<Components z:Size="5">
<Component z:Ref="4" i:nil="true" />
<Component z:Id="7" i:type="RenderComponent">
<m_guid>a88b8555-2fb5-4b5a-8269-9bdb2df03ecb</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Ref="5" i:nil="true" />
<material z:Id="8">
<path z:Id="9"></path>
</material>
<model z:Id="10">
<path z:Id="11">../Data/primitives/cube.obj</path>
</model>
</Component>
<Component z:Id="12" i:type="Rigidbody">
<m_guid>080b09d6-77f1-4949-8649-9b88fd15fe98</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Ref="5" i:nil="true" />
<AngularVelocity>
<x>0</x>
<y>0</y>
<z>0</z>
</AngularVelocity>
<FrzPos>
<x>1</x>
<y>1</y>
<z>1</z>
</FrzPos>
<FrzRot>
<x>1</x>
<y>1</y>
<z>1</z>
</FrzRot>
<IsKinematic>false</IsKinematic>
<LinearVelocity>
<x>0</x>
<y>0</y>
<z>0</z>
</LinearVelocity>
<Mass>1</Mass>
</Component>
<Component z:Id="13" i:type="BoxCollider">
<m_guid>07c610da-3ec3-4bea-8ceb-7637d9d1e2cc</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Ref="5" i:nil="true" />
<attachedRigidbody i:nil="true" />
<isTrigger>false</isTrigger>
<center>
<x>0</x>
<y>0</y>
<z>0</z>
</center>
<size>
<x>0.5</x>
<y>0.5</y>
<z>0.5</z>
</size>
</Component>
<Component z:Id="14" xmlns:d7p1="http://schemas.datacontract.org/2004/07/ThomasEditor" i:type="d7p1:ChadControls">
<m_guid>58ae29c1-550d-4ec8-b4ae-325752287309</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Ref="5" i:nil="true" />
<isOwner xmlns="http://schemas.datacontract.org/2004/07/ThomasEngine.Network">false</isOwner>
<d7p1:camPrefab i:nil="true" />
<d7p1:force>5</d7p1:force>
<d7p1:rotationSpeed>1</d7p1:rotationSpeed>
<d7p1:speed>5</d7p1:speed>
</Component>
</Components>
<activeSelf>true</activeSelf>
<transform z:Ref="4" i:nil="true" />
</m_gameObject>
<children z:Size="1">
<Transform z:Ref="3" i:nil="true" />
</children>
<localEulerAngles>
<x>0</x>
<y>0</y>
<z>-0</z>
</localEulerAngles>
<localPosition>
<x>0</x>
<y>2.27688313</y>
<z>0</z>
</localPosition>
<localScale>
<x>1</x>
<y>1</y>
<z>1</z>
</localScale>
<parent i:nil="true" />
</parent>
</Component>
<Component z:Id="15" i:type="Camera">
<m_guid>b54adef6-2006-483f-9b16-062516e24691</m_guid>
<m_name i:nil="true" />
<m_enabled>true</m_enabled>
<m_gameObject z:Ref="1" i:nil="true" />
<farPlane>10000</farPlane>
<fieldOfView>70</fieldOfView>
<nearPlane>0.5</nearPlane>
<targetDisplay>0</targetDisplay>
</Component>
</Components>
<activeSelf>true</activeSelf>
<transform z:Ref="3" i:nil="true" />
</GameObject>
12 changes: 6 additions & 6 deletions Concussion Ball/Concussion Ball.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\Ball.cs" />
<Compile Include="Assets\InputTest.cs" />
<Compile Include="Assets\Scripts\Ball.cs" />
<Compile Include="Assets\AnimationBlendTest.cs" />
<Compile Include="Assets\collisionTest.cs" />
<Compile Include="Assets\DankLight.cs" />
<Compile Include="Assets\skeletonSyncer.cs" />
<Compile Include="Assets\Scripts\chadControls.cs" />
<Compile Include="Assets\throwStrengthVisualizer.cs" />
<Compile Include="Assets\Scripts\collisionTest.cs" />
<Compile Include="Assets\Scripts\DankLight.cs" />
<Compile Include="Assets\Scripts\InputTest.cs" />
<Compile Include="Assets\Scripts\skeletonSyncer.cs" />
<Compile Include="Assets\Scripts\throwStrengthVisualizer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup />
Expand Down

0 comments on commit a2db9c5

Please sign in to comment.