Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gadig
four
Commits
b75c40b0
Commit
b75c40b0
authored
Oct 27, 2016
by
Jordan McKenney
Browse files
Added files I was working on because i dont have a computer
parent
ae59fabf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Assets/Prefabs/FireballProjectile.prefab
0 → 100644
View file @
b75c40b0
File added
Assets/Prefabs/FireballProjectile.prefab.meta
0 → 100644
View file @
b75c40b0
fileFormatVersion: 2
guid: b3b2f4d882443b4479197c16a3a047f9
timeCreated: 1477616236
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/script/FireballMove.cs
0 → 100644
View file @
b75c40b0
using
UnityEngine
;
using
System.Collections
;
public
class
FireballMove
:
MonoBehaviour
{
public
float
speed
;
private
Rigidbody2D
fireRB
;
public
int
direction
;
public
Vector2
move
;
// Use this for initialization
void
Start
()
{
fireRB
=
GetComponent
<
Rigidbody2D
>
();
/*
if (direction == 0)
move = new Vector2 (1,0);
if (direction == 1)
move = new Vector2 (0,1);
if (direction == 2)
move = new Vector2 (-1,0);
if (direction == 3)
move = new Vector2 (0,-1);
*/
}
// Update is called once per frame
void
Update
()
{
fireRB
.
MovePosition
((
Vector2
)
transform
.
position
+
move
*
speed
);
}
}
Assets/script/FireballMove.cs.meta
0 → 100644
View file @
b75c40b0
fileFormatVersion: 2
guid: b245668d1f70fae43ba9905676a8f688
timeCreated: 1477616043
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/script/HeroAttackController.cs
View file @
b75c40b0
...
@@ -4,8 +4,11 @@ using System.Collections;
...
@@ -4,8 +4,11 @@ using System.Collections;
public
class
HeroAttackController
:
MonoBehaviour
{
public
class
HeroAttackController
:
MonoBehaviour
{
enum
ability
{
fireball
,
water
,
others
};
enum
ability
{
fireball
,
water
,
others
};
public
int
direction
;
public
float
speed
;
private
ability
currentAbility
=
ability
.
fireball
;
private
ability
currentAbility
=
ability
.
fireball
;
public
GameObject
FireballPrefab
;
// Use this for initialization
// Use this for initialization
void
Start
()
{
void
Start
()
{
...
@@ -17,7 +20,11 @@ public class HeroAttackController : MonoBehaviour {
...
@@ -17,7 +20,11 @@ public class HeroAttackController : MonoBehaviour {
if
(
Input
.
GetButtonDown
(
"Fire1"
)){
if
(
Input
.
GetButtonDown
(
"Fire1"
)){
switch
(
currentAbility
)
switch
(
currentAbility
)
{
{
case
ability
.
fireball
:
case
ability
.
fireball
:
GameObject
clone
=
Instantiate
(
FireballPrefab
,
new
Vector3
(
0
,
0
,
0
),
Quaternion
.
identity
)
as
GameObject
;
clone
.
GetComponent
<
FireballMove
>
().
move
=
GetComponent
<
PlayerAnimation
>
().
lastInput
;
clone
.
GetComponent
<
FireballMove
>
().
speed
=
speed
;
Debug
.
Log
(
"fireball"
);
Debug
.
Log
(
"fireball"
);
break
;
break
;
default
:
default
:
...
...
Assets/script/PlayerAnimation.cs
View file @
b75c40b0
...
@@ -4,7 +4,7 @@ using System.Collections;
...
@@ -4,7 +4,7 @@ using System.Collections;
public
class
PlayerAnimation
:
MonoBehaviour
{
public
class
PlayerAnimation
:
MonoBehaviour
{
private
Animator
animator
;
private
Animator
animator
;
p
rivate
Vector2
lastInput
=
new
Vector2
(
1
,
1
);
p
ublic
Vector2
lastInput
=
new
Vector2
(
1
,
1
);
private
int
horizontalDir
=
1
;
private
int
horizontalDir
=
1
;
private
HeroMobility
hm
;
private
HeroMobility
hm
;
...
...
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