Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
FireballsClone
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731021
FireballsClone
Commits
36fd7e99
Commit
36fd7e99
authored
Mar 12, 2021
by
Parsa Rahmaty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The direction of the cannonballs is fixed
parent
94759b2c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
583 additions
and
62 deletions
+583
-62
Cannonball.prefab
Assets/Prefabs/Cannonball.prefab
+13
-0
Node Holder.prefab
Assets/Prefabs/Node Holder.prefab
+1
-1
Stack Node.prefab
Assets/Prefabs/Stack Node.prefab
+3
-2
SampleScene.unity
Assets/Scenes/SampleScene.unity
+73
-21
TestScene.unity
Assets/Scenes/TestScene.unity
+416
-0
TestScene.unity.meta
Assets/Scenes/TestScene.unity.meta
+7
-0
Movable.cs
Assets/Scripts/General Purpose/Movable.cs
+35
-2
CannonControls.cs
Assets/Scripts/Object Related/CannonControls.cs
+7
-7
Cannonball.cs
Assets/Scripts/Object Related/Cannonball.cs
+2
-4
NodeHolder.cs
Assets/Scripts/Object Related/NodeHolder.cs
+6
-7
StackNode.cs
Assets/Scripts/Object Related/StackNode.cs
+10
-5
DynamicsManager.asset
ProjectSettings/DynamicsManager.asset
+3
-5
ProjectSettings.asset
ProjectSettings/ProjectSettings.asset
+2
-2
TagManager.asset
ProjectSettings/TagManager.asset
+5
-6
No files found.
Assets/Prefabs/Cannonball.prefab
View file @
36fd7e99
...
@@ -14,6 +14,7 @@ GameObject:
...
@@ -14,6 +14,7 @@ GameObject:
-
component
:
{
fileID
:
400804237596747917
}
-
component
:
{
fileID
:
400804237596747917
}
-
component
:
{
fileID
:
5560186350293350528
}
-
component
:
{
fileID
:
5560186350293350528
}
-
component
:
{
fileID
:
1317944747836374153
}
-
component
:
{
fileID
:
1317944747836374153
}
-
component
:
{
fileID
:
5687028221148072821
}
m_Layer
:
8
m_Layer
:
8
m_Name
:
Cannonball
m_Name
:
Cannonball
m_TagString
:
Cannonball
m_TagString
:
Cannonball
...
@@ -124,3 +125,15 @@ MonoBehaviour:
...
@@ -124,3 +125,15 @@ MonoBehaviour:
m_Name
:
m_Name
:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
speed
:
30
speed
:
30
---
!u!114
&5687028221148072821
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
3972782314967972539
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
e3cf5829d03eb97459c57901b7efff3d
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Assets/Prefabs/Node Holder.prefab
View file @
36fd7e99
...
@@ -25,7 +25,7 @@ Transform:
...
@@ -25,7 +25,7 @@ Transform:
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
2984237215047306181
}
m_GameObject
:
{
fileID
:
2984237215047306181
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
-1.5
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_Father
:
{
fileID
:
0
}
...
...
Assets/Prefabs/Stack Node.prefab
View file @
36fd7e99
...
@@ -32,7 +32,7 @@ Transform:
...
@@ -32,7 +32,7 @@ Transform:
m_GameObject
:
{
fileID
:
8953703217792660207
}
m_GameObject
:
{
fileID
:
8953703217792660207
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
10
,
y
:
0.
2
5
,
z
:
10
}
m_LocalScale
:
{
x
:
10
,
y
:
0.5
,
z
:
10
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_RootOrder
:
0
...
@@ -98,6 +98,7 @@ MonoBehaviour:
...
@@ -98,6 +98,7 @@ MonoBehaviour:
m_EditorClassIdentifier
:
m_EditorClassIdentifier
:
rotationSpeed
:
20
rotationSpeed
:
20
descendTime
:
0.2
descendTime
:
0.2
nodeHeight
:
1
---
!u!114
&5704020906800342289
---
!u!114
&5704020906800342289
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -136,7 +137,7 @@ BoxCollider:
...
@@ -136,7 +137,7 @@ BoxCollider:
m_GameObject
:
{
fileID
:
8953703217792660207
}
m_GameObject
:
{
fileID
:
8953703217792660207
}
m_Material
:
{
fileID
:
13400000
,
guid
:
767de626f0734e747b948a518e3e7918
,
type
:
2
}
m_Material
:
{
fileID
:
13400000
,
guid
:
767de626f0734e747b948a518e3e7918
,
type
:
2
}
m_IsTrigger
:
0
m_IsTrigger
:
0
m_Enabled
:
1
m_Enabled
:
0
serializedVersion
:
2
serializedVersion
:
2
m_Size
:
{
x
:
1.0000001
,
y
:
2
,
z
:
1.0000002
}
m_Size
:
{
x
:
1.0000001
,
y
:
2
,
z
:
1.0000002
}
m_Center
:
{
x
:
0.000000059604645
,
y
:
0
,
z
:
-0.00000008940697
}
m_Center
:
{
x
:
0.000000059604645
,
y
:
0
,
z
:
-0.00000008940697
}
...
...
Assets/Scenes/SampleScene.unity
View file @
36fd7e99
...
@@ -149,7 +149,7 @@ Transform:
...
@@ -149,7 +149,7 @@ Transform:
m_GameObject
:
{
fileID
:
58095958
}
m_GameObject
:
{
fileID
:
58095958
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
-2
,
z
:
15
}
m_LocalPosition
:
{
x
:
0
,
y
:
-2
,
z
:
15
}
m_LocalScale
:
{
x
:
30
,
y
:
0.25
,
z
:
30
}
m_LocalScale
:
{
x
:
25
,
y
:
0.25
,
z
:
25
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
768744113
}
m_Father
:
{
fileID
:
768744113
}
m_RootOrder
:
0
m_RootOrder
:
0
...
@@ -214,6 +214,37 @@ MeshFilter:
...
@@ -214,6 +214,37 @@ MeshFilter:
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
58095958
}
m_GameObject
:
{
fileID
:
58095958
}
m_Mesh
:
{
fileID
:
10206
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_Mesh
:
{
fileID
:
10206
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
---
!u!1
&135398378
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
135398379
}
m_Layer
:
0
m_Name
:
Cannon Holder
m_TagString
:
Player
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&135398379
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
135398378
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
-
{
fileID
:
1827272339
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
3
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&446428163
stripped
---
!u!4
&446428163
stripped
Transform
:
Transform
:
m_CorrespondingSourceObject
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
m_CorrespondingSourceObject
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
...
@@ -518,7 +549,7 @@ Transform:
...
@@ -518,7 +549,7 @@ Transform:
m_LocalScale
:
{
x
:
1
,
y
:
0.5
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
0.5
,
z
:
1
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
1827272339
}
m_Father
:
{
fileID
:
1827272339
}
m_RootOrder
:
1
m_RootOrder
:
2
m_LocalEulerAnglesHint
:
{
x
:
90
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
90
,
y
:
0
,
z
:
0
}
---
!u!136
&1384577412
---
!u!136
&1384577412
CapsuleCollider
:
CapsuleCollider
:
...
@@ -612,7 +643,7 @@ Transform:
...
@@ -612,7 +643,7 @@ Transform:
m_LocalScale
:
{
x
:
2
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
2
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
[]
m_Father
:
{
fileID
:
1827272339
}
m_Father
:
{
fileID
:
1827272339
}
m_RootOrder
:
0
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!65
&1389915129
---
!u!65
&1389915129
BoxCollider
:
BoxCollider
:
...
@@ -674,6 +705,36 @@ MeshFilter:
...
@@ -674,6 +705,36 @@ MeshFilter:
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1389915127
}
m_GameObject
:
{
fileID
:
1389915127
}
m_Mesh
:
{
fileID
:
10202
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_Mesh
:
{
fileID
:
10202
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
---
!u!1
&1414855918
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1414855919
}
m_Layer
:
0
m_Name
:
Shooting Target
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!4
&1414855919
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1414855918
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
10
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
1827272339
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&1827272338
---
!u!1
&1827272338
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -686,7 +747,7 @@ GameObject:
...
@@ -686,7 +747,7 @@ GameObject:
-
component
:
{
fileID
:
1827272340
}
-
component
:
{
fileID
:
1827272340
}
m_Layer
:
0
m_Layer
:
0
m_Name
:
Cannon
m_Name
:
Cannon
m_TagString
:
Player
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_StaticEditorFlags
:
0
...
@@ -702,10 +763,11 @@ Transform:
...
@@ -702,10 +763,11 @@ Transform:
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
m_Children
:
-
{
fileID
:
1414855919
}
-
{
fileID
:
1389915128
}
-
{
fileID
:
1389915128
}
-
{
fileID
:
1384577411
}
-
{
fileID
:
1384577411
}
m_Father
:
{
fileID
:
0
}
m_Father
:
{
fileID
:
135398379
}
m_RootOrder
:
3
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&1827272340
---
!u!114
&1827272340
MonoBehaviour
:
MonoBehaviour
:
...
@@ -929,21 +991,6 @@ PrefabInstance:
...
@@ -929,21 +991,6 @@ PrefabInstance:
propertyPath
:
m_LocalRotation.w
propertyPath
:
m_LocalRotation.w
value
:
1
value
:
1
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
type
:
3
}
propertyPath
:
m_LocalPosition.x
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
type
:
3
}
propertyPath
:
m_LocalPosition.y
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
type
:
3
}
propertyPath
:
m_LocalPosition.z
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
-
target
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
type
:
3
}
type
:
3
}
propertyPath
:
m_LocalRotation.x
propertyPath
:
m_LocalRotation.x
...
@@ -984,6 +1031,11 @@ PrefabInstance:
...
@@ -984,6 +1031,11 @@ PrefabInstance:
propertyPath
:
m_LocalEulerAnglesHint.z
propertyPath
:
m_LocalEulerAnglesHint.z
value
:
0
value
:
0
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2984237215047306180
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
type
:
3
}
propertyPath
:
m_LocalPosition.y
value
:
-1.25
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
2984237215047306181
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
-
target
:
{
fileID
:
2984237215047306181
,
guid
:
90b16e9d09448504aa823b8ca0032ddf
,
type
:
3
}
type
:
3
}
propertyPath
:
m_Name
propertyPath
:
m_Name
...
...
Assets/Scenes/TestScene.unity
0 → 100644
View file @
36fd7e99
This diff is collapsed.
Click to expand it.
Assets/Scenes/TestScene.unity.meta
0 → 100644
View file @
36fd7e99
fileFormatVersion: 2
guid: 128561e13f43bd346a528566cbe5223d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/General Purpose/Movable.cs
View file @
36fd7e99
...
@@ -4,10 +4,27 @@ using UnityEngine;
...
@@ -4,10 +4,27 @@ using UnityEngine;
public
class
Movable
:
MonoBehaviour
public
class
Movable
:
MonoBehaviour
{
{
// Destination-based movement fields
private
Vector3
startPosition
;
private
Vector3
startPosition
;
public
Vector3
targetPosition
{
get
;
private
set
;
}
public
Vector3
targetPosition
{
get
;
private
set
;
}
private
float
time
;
private
float
time
;
private
float
timeToReachTarget
;
private
float
timeToReachTarget
;
//=====================================================
// Direction-based movement fields
private
Vector3
direction
;
private
float
speed
;
private
bool
isOnWorldSpace
;
//=====================================================
enum
Mode
{
Destination
,
Direction
,
Neutral
}
private
Mode
mode
=
Mode
.
Neutral
;
void
Start
()
void
Start
()
{
{
...
@@ -15,10 +32,17 @@ public class Movable : MonoBehaviour
...
@@ -15,10 +32,17 @@ public class Movable : MonoBehaviour
}
}
void
Update
()
void
Update
()
{
if
(
mode
==
Mode
.
Destination
)
{
{
time
+=
Time
.
deltaTime
/
timeToReachTarget
;
time
+=
Time
.
deltaTime
/
timeToReachTarget
;
transform
.
position
=
Vector3
.
Lerp
(
startPosition
,
targetPosition
,
time
);
transform
.
position
=
Vector3
.
Lerp
(
startPosition
,
targetPosition
,
time
);
}
}
else
if
(
mode
==
Mode
.
Direction
)
{
transform
.
Translate
(
Vector3
.
Normalize
(
direction
)
*
speed
*
Time
.
deltaTime
,
(
isOnWorldSpace
?
Space
.
World
:
Space
.
Self
));
}
}
public
void
SetDestination
(
Vector3
destination
,
float
time
)
public
void
SetDestination
(
Vector3
destination
,
float
time
)
{
{
...
@@ -26,5 +50,14 @@ public class Movable : MonoBehaviour
...
@@ -26,5 +50,14 @@ public class Movable : MonoBehaviour
startPosition
=
transform
.
position
;
startPosition
=
transform
.
position
;
timeToReachTarget
=
time
;
timeToReachTarget
=
time
;
targetPosition
=
destination
;
targetPosition
=
destination
;
mode
=
Mode
.
Destination
;
}
public
void
SetDirection
(
Vector3
direction
,
float
speed
,
bool
isOnWorldSpace
)
{
this
.
direction
=
direction
;
this
.
speed
=
speed
;
this
.
isOnWorldSpace
=
isOnWorldSpace
;
mode
=
Mode
.
Direction
;
}
}
}
}
Assets/Scripts/Object Related/CannonControls.cs
View file @
36fd7e99
...
@@ -8,7 +8,7 @@ public class CannonControls : MonoBehaviour
...
@@ -8,7 +8,7 @@ public class CannonControls : MonoBehaviour
[
SerializeField
]
private
float
shootingDelay
=
0.2f
;
[
SerializeField
]
private
float
shootingDelay
=
0.2f
;
[
SerializeField
]
private
Collider
[]
cannonColliders
=
null
;
[
SerializeField
]
private
Collider
[]
cannonColliders
=
null
;
private
float
delay
;
private
float
delay
;
private
float
framesLeftToShoot
=
0f
;
// the number of frames
passed since last shot
private
float
timeLeftToShoot
=
0f
;
// the amount of time
passed since last shot
void
Start
()
void
Start
()
{
{
...
@@ -19,28 +19,28 @@ public class CannonControls : MonoBehaviour
...
@@ -19,28 +19,28 @@ public class CannonControls : MonoBehaviour
{
{
if
(
Input
.
GetKey
(
KeyCode
.
Space
))
if
(
Input
.
GetKey
(
KeyCode
.
Space
))
{
{
if
(
frames
LeftToShoot
<=
0f
)
if
(
time
LeftToShoot
<=
0f
)
{
{
// start shooting cannonballs
// start shooting cannonballs
GameObject
childObject
=
Instantiate
(
projectile
)
as
GameObject
;
GameObject
childObject
=
Instantiate
(
projectile
)
as
GameObject
;
foreach
(
Collider
collider
in
cannonColliders
)
foreach
(
Collider
collider
in
cannonColliders
)
Physics
.
IgnoreCollision
(
childObject
.
GetComponent
<
Sphere
Collider
>(),
collider
,
true
);
Physics
.
IgnoreCollision
(
childObject
.
GetComponent
<
Collider
>(),
collider
,
true
);
childObject
.
transform
.
parent
=
gameObject
.
transform
;
childObject
.
transform
.
parent
=
gameObject
.
transform
;
childObject
.
transform
.
localPosition
=
new
Vector3
(
0
,
0
,
0
);
childObject
.
transform
.
localPosition
=
new
Vector3
(
0
,
0
,
0
);
childObject
.
transform
.
LookAt
(
GameObject
.
Find
(
"Shooting Target"
).
transform
);
if
(
delay
>
(
shootingDelay
*
1f
)
/
2f
)
if
(
delay
>
(
shootingDelay
*
1f
)
/
2f
)
delay
*=
0.95f
;
delay
*=
0.95f
;
frames
LeftToShoot
=
delay
;
time
LeftToShoot
=
delay
;
}
}
else
else
{
{
frames
LeftToShoot
-=
Time
.
deltaTime
;
time
LeftToShoot
-=
Time
.
deltaTime
;
}
}
}
}
if
(
Input
.
GetKeyUp
(
KeyCode
.
Space
))
if
(
Input
.
GetKeyUp
(
KeyCode
.
Space
))
{
{
delay
=
shootingDelay
;
delay
=
shootingDelay
;
frames
LeftToShoot
=
0f
;
time
LeftToShoot
=
0f
;
}
}
}
}
}
}
Assets/Scripts/Object Related/Cannonball.cs
View file @
36fd7e99
...
@@ -4,13 +4,11 @@ using UnityEngine;
...
@@ -4,13 +4,11 @@ using UnityEngine;
public
class
Cannonball
:
MonoBehaviour
public
class
Cannonball
:
MonoBehaviour
{
{
public
int
speed
=
10
;
public
float
speed
=
10f
;
private
new
Rigidbody
rigidbody
;
void
Awake
()
void
Awake
()
{
{
rigidbody
=
GetComponent
<
Rigidbody
>();
GetComponent
<
Movable
>().
SetDirection
(
Vector3
.
forward
,
speed
,
false
);
rigidbody
.
velocity
=
new
Vector3
(
0
,
0
,
speed
);
Destroy
(
this
.
gameObject
,
1f
);
Destroy
(
this
.
gameObject
,
1f
);
}
}
...
...
Assets/Scripts/Object Related/NodeHolder.cs
View file @
36fd7e99
...
@@ -8,24 +8,23 @@ public class NodeHolder : MonoBehaviour
...
@@ -8,24 +8,23 @@ public class NodeHolder : MonoBehaviour
[
SerializeField
]
private
DestroyableObject
stackNodeObject
=
null
;
[
SerializeField
]
private
DestroyableObject
stackNodeObject
=
null
;
void
Awake
()
{
nodes
=
new
LinkedList
<
DestroyableObject
>();
}
public
void
MakeNodes
(
int
numberOfNodes
)
public
void
MakeNodes
(
int
numberOfNodes
)
{
{
for
(
int
i
=
0
;
i
<
nodes
.
Count
;
i
++)
if
(
nodes
==
null
)
nodes
=
new
LinkedList
<
DestroyableObject
>();
for
(
int
i
=
0
;
i
<
nodes
.
Count
;
i
++)
{
{
nodes
.
First
.
Value
.
Kill
();
nodes
.
First
.
Value
.
Kill
();
nodes
.
RemoveFirst
();
nodes
.
RemoveFirst
();
}
}
// The linked list is now empty
// The linked list is now empty
float
nodeHeight
=
stackNodeObject
.
gameObject
.
GetComponent
<
StackNode
>().
GetNodeHeight
();
for
(
int
i
=
0
;
i
<
numberOfNodes
;
i
++)
for
(
int
i
=
0
;
i
<
numberOfNodes
;
i
++)
{
{
DestroyableObject
node
=
Instantiate
(
stackNodeObject
);
DestroyableObject
node
=
Instantiate
(
stackNodeObject
);
node
.
transform
.
parent
=
gameObject
.
transform
;
node
.
transform
.
parent
=
gameObject
.
transform
;
node
.
transform
.
localPosition
=
new
Vector3
(
0f
,
i
*
0.5f
,
0f
);
//if(nodeHeight == 0f) nodeHeight = node.gameObject.GetComponent<StackNode>()
node
.
transform
.
localPosition
=
new
Vector3
(
0f
,
i
*
nodeHeight
,
0f
);
nodes
.
AddLast
(
node
);
nodes
.
AddLast
(
node
);
}
}
}
}
...
...
Assets/Scripts/Object Related/StackNode.cs
View file @
36fd7e99
...
@@ -6,8 +6,8 @@ public class StackNode : MonoBehaviour
...
@@ -6,8 +6,8 @@ public class StackNode : MonoBehaviour
{
{
[
SerializeField
]
private
float
rotationSpeed
=
10f
;
[
SerializeField
]
private
float
rotationSpeed
=
10f
;
[
SerializeField
]
private
float
descendTime
=
0.2f
;
[
SerializeField
]
private
float
descendTime
=
0.2f
;
[
SerializeField
]
private
float
nodeHeight
=
1f
;
private
float
descendDistance
=
0.5f
;
private
Movable
movable
;
private
Movable
movable
;
private
void
Awake
()
private
void
Awake
()
...
@@ -25,13 +25,18 @@ public class StackNode : MonoBehaviour
...
@@ -25,13 +25,18 @@ public class StackNode : MonoBehaviour
transform
.
localEulerAngles
+=
new
Vector3
(
0f
,
rotationSpeed
*
Time
.
fixedDeltaTime
,
0f
);
transform
.
localEulerAngles
+=
new
Vector3
(
0f
,
rotationSpeed
*
Time
.
fixedDeltaTime
,
0f
);
}
}
private
void
Descend
()
private
void
OnDestroy
()
{
{
movable
.
SetDestination
(
movable
.
targetPosition
-
new
Vector3
(
0f
,
descendDistance
,
0f
),
descendTime
)
;
GameEvents
.
instance
.
onHitEvent
-=
Descend
;
}
}
p
rivate
void
OnDestroy
()
p
ublic
float
GetNodeHeight
()
{
{
GameEvents
.
instance
.
onHitEvent
-=
Descend
;
return
nodeHeight
;
}
private
void
Descend
()
{
movable
.
SetDestination
(
movable
.
targetPosition
-
new
Vector3
(
0f
,
nodeHeight
,
0f
),
descendTime
);
}
}
}
}
ProjectSettings/DynamicsManager.asset
View file @
36fd7e99
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
---
!u!55
&1
---
!u!55
&1
PhysicsManager
:
PhysicsManager
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
serializedVersion
:
1
3
serializedVersion
:
1
1
m_Gravity
:
{
x
:
0
,
y
:
-9.81
,
z
:
0
}
m_Gravity
:
{
x
:
0
,
y
:
-9.81
,
z
:
0
}
m_DefaultMaterial
:
{
fileID
:
0
}
m_DefaultMaterial
:
{
fileID
:
0
}
m_BounceThreshold
:
2
m_BounceThreshold
:
2
...
@@ -17,12 +17,11 @@ PhysicsManager:
...
@@ -17,12 +17,11 @@ PhysicsManager:
m_ClothInterCollisionDistance
:
0
m_ClothInterCollisionDistance
:
0
m_ClothInterCollisionStiffness
:
0
m_ClothInterCollisionStiffness
:
0
m_ContactsGeneration
:
1
m_ContactsGeneration
:
1
m_LayerCollisionMatrix
:
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
8fffffff6fffffff2fffffff9
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix
:
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
fffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation
:
1
m_AutoSimulation
:
1
m_AutoSyncTransforms
:
0
m_AutoSyncTransforms
:
0
m_ReuseCollisionCallbacks
:
1
m_ReuseCollisionCallbacks
:
1
m_ClothInterCollisionSettingsToggle
:
0
m_ClothInterCollisionSettingsToggle
:
0
m_ClothGravity
:
{
x
:
0
,
y
:
-9.81
,
z
:
0
}
m_ContactPairsMode
:
0
m_ContactPairsMode
:
0
m_BroadphaseType
:
0
m_BroadphaseType
:
0
m_WorldBounds
:
m_WorldBounds
:
...
@@ -32,5 +31,4 @@ PhysicsManager:
...
@@ -32,5 +31,4 @@ PhysicsManager:
m_FrictionType
:
0
m_FrictionType
:
0
m_EnableEnhancedDeterminism
:
0
m_EnableEnhancedDeterminism
:
0
m_EnableUnifiedHeightmaps
:
1
m_EnableUnifiedHeightmaps
:
1
m_SolverType
:
0
m_DefaultMaxAngluarSpeed
:
7
m_DefaultMaxAngularSpeed
:
7
ProjectSettings/ProjectSettings.asset
View file @
36fd7e99
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
PlayerSettings
:
PlayerSettings
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
serializedVersion
:
20
serializedVersion
:
20
productGUID
:
21
d8bd3464428934ba031177685f86ed
productGUID
:
21
a5c9b0a93b4a1459fa4214094e8009
AndroidProfiler
:
0
AndroidProfiler
:
0
AndroidFilterTouchesWhenObscured
:
0
AndroidFilterTouchesWhenObscured
:
0
AndroidEnableSustainedPerformanceMode
:
0
AndroidEnableSustainedPerformanceMode
:
0
...
@@ -13,7 +13,7 @@ PlayerSettings:
...
@@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources
:
0
useOnDemandResources
:
0
accelerometerFrequency
:
60
accelerometerFrequency
:
60
companyName
:
DefaultCompany
companyName
:
DefaultCompany
productName
:
FireballsClone
productName
:
New
FireballsClone
defaultCursor
:
{
fileID
:
0
}
defaultCursor
:
{
fileID
:
0
}
cursorHotspot
:
{
x
:
0
,
y
:
0
}
cursorHotspot
:
{
x
:
0
,
y
:
0
}
m_SplashScreenBackgroundColor
:
{
r
:
0.13725491
,
g
:
0.12156863
,
b
:
0.1254902
,
a
:
1
}
m_SplashScreenBackgroundColor
:
{
r
:
0.13725491
,
g
:
0.12156863
,
b
:
0.1254902
,
a
:
1
}
...
...
ProjectSettings/TagManager.asset
View file @
36fd7e99
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
---
!u!78
&1
---
!u!78
&1
TagManager
:
TagManager
:
serializedVersion
:
2
serializedVersion
:
2
tags
:
tags
:
[]
-
Cannonball
layers
:
layers
:
-
Default
-
Default
-
TransparentFX
-
TransparentFX
...
@@ -14,10 +13,10 @@ TagManager:
...
@@ -14,10 +13,10 @@ TagManager:
-
UI
-
UI
-
-
-
-
-
Cannonball
-
-
Stack Node
-
-
Ground
-
-
Stack
-
-
-
-
-
-
-
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment