Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions InteractivePhysicsSimulation/Assets/ChangeImage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ChangeImage : MonoBehaviour {

public Sprite start;
public Sprite stop;
Image image;

public void Start()
{
image = GetComponent<Image>();
image.sprite = stop;
}

public void changeSprite()
{
if (image.sprite.name.Equals("StopButton"))
{
image.sprite = start;
}
else if (image.sprite.name.Equals("StartButton"))
{
image.sprite = stop;
}
}
}
11 changes: 11 additions & 0 deletions InteractivePhysicsSimulation/Assets/ChangeImage.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions InteractivePhysicsSimulation/Assets/ObjectSpawner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ObjectSpawner : MonoBehaviour {

public GameObject prefab;
public Transform spawn;

// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(2))
{
StartCoroutine(SpawnBlock());
}
}

IEnumerator SpawnBlock()
{
Instantiate(prefab, spawn);
yield return new WaitForSeconds(1);
}
}
11 changes: 11 additions & 0 deletions InteractivePhysicsSimulation/Assets/ObjectSpawner.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 75 additions & 3 deletions InteractivePhysicsSimulation/Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
m_IndirectSpecularColor: {r: 0.37311992, g: 0.38074034, b: 0.35872713, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -130,7 +130,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4070721296700812, guid: 0e9f59d8cb7a69442a26da2f8646e9c3, type: 2}
propertyPath: m_LocalPosition.z
value: 1
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4070721296700812, guid: 0e9f59d8cb7a69442a26da2f8646e9c3, type: 2}
propertyPath: m_LocalRotation.x
Expand Down Expand Up @@ -171,6 +171,7 @@ GameObject:
- component: {fileID: 138619146}
- component: {fileID: 138619145}
- component: {fileID: 138619149}
- component: {fileID: 138619150}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -255,6 +256,24 @@ MonoBehaviour:
mouseSensitivityVertical: 2
mouseSensitivityHorizontal: 2
cameraSpeed: 5
--- !u!114 &138619150
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 138619144}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ed5389b38da9d8c4997ddee338ee9479, type: 3}
m_Name:
m_EditorClassIdentifier:
prefab: {fileID: 292190563}
spawn: {fileID: 1590460631}
--- !u!1 &292190563 stripped
GameObject:
m_PrefabParentObject: {fileID: 1997613620225914, guid: 0e9f59d8cb7a69442a26da2f8646e9c3,
type: 2}
m_PrefabInternal: {fileID: 20908010}
--- !u!1001 &791842430
Prefab:
m_ObjectHideFlags: 0
Expand All @@ -272,7 +291,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4752926852536184, guid: e06be632ea950354ebf701b605a91291, type: 2}
propertyPath: m_LocalPosition.z
value: 2
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4752926852536184, guid: e06be632ea950354ebf701b605a91291, type: 2}
propertyPath: m_LocalRotation.x
Expand Down Expand Up @@ -589,6 +608,34 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1590460630
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1590460631}
m_Layer: 0
m_Name: Spawn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1590460631
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1590460630}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 10, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1835761284
Prefab:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -642,6 +689,7 @@ GameObject:
- component: {fileID: 2141287458}
- component: {fileID: 2141287457}
- component: {fileID: 2141287456}
- component: {fileID: 2141287455}
m_Layer: 5
m_Name: Button
m_TagString: Untagged
Expand All @@ -667,6 +715,19 @@ RectTransform:
m_AnchoredPosition: {x: -80, y: -30}
m_SizeDelta: {x: 135.74, y: 34.95}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2141287455
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2141287453}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e41d03d4ae19f9546b9da0fd50ac260e, type: 3}
m_Name:
m_EditorClassIdentifier:
start: {fileID: 21300000, guid: fbfacf63265a27245abb31755a8c789a, type: 3}
stop: {fileID: 21300000, guid: 520f2106d0bc0f64da4f877e256893c5, type: 3}
--- !u!114 &2141287456
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -717,6 +778,17 @@ MonoBehaviour:
m_StringArgument: TogglePlayPause()
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 2141287455}
m_MethodName: changeSprite
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &2141287457
Expand Down