-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
118 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,83 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class CharFightAnimation : MonoBehaviour { | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
|
||
} | ||
public class CharFightAnimation : MonoBehaviour | ||
{ | ||
public static int UP = 3; | ||
public static int DOWN = 0; | ||
public static int LEFT = 2; | ||
public static int RIGHT = 1; | ||
|
||
|
||
public bool isMoving = false; | ||
public int animationSpeed; | ||
|
||
|
||
private int direction; | ||
private int countAnimation; | ||
private int atualAnimation; | ||
|
||
|
||
void Start() | ||
{ | ||
direction = 0; | ||
countAnimation = 0; | ||
atualAnimation = 0; | ||
|
||
Vector2 pt = new Vector2(0.05f, -0.1f * this.GetComponent<CharFightController>().character.sprite); | ||
renderer.material.SetTextureOffset("_MainTex", pt); | ||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
float num = 0; | ||
if (isMoving) | ||
{ | ||
|
||
countAnimation++; | ||
if (countAnimation > animationSpeed) | ||
{ | ||
atualAnimation++; | ||
if (atualAnimation >= 3) | ||
{ | ||
atualAnimation = 0; | ||
} | ||
countAnimation = 0; | ||
} | ||
|
||
num = 3 * direction + atualAnimation; | ||
|
||
Vector2 pt = new Vector2(0.05f * num, -0.1f * this.GetComponent<GameCharacterController>().character.sprite); | ||
|
||
renderer.material.SetTextureOffset("_MainTex", pt); | ||
|
||
} | ||
else | ||
{ | ||
countAnimation = 0; | ||
} | ||
} | ||
|
||
public void moveUp() | ||
{ | ||
direction = SpriteAnimation.UP; | ||
isMoving = true; | ||
} | ||
public void moveDown() | ||
{ | ||
direction = SpriteAnimation.DOWN; | ||
isMoving = true; | ||
} | ||
public void moveLeft() | ||
{ | ||
direction = SpriteAnimation.LEFT; | ||
isMoving = true; | ||
} | ||
public void moveRight() | ||
{ | ||
direction = SpriteAnimation.RIGHT; | ||
isMoving = true; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters