Skip to content

Commit

Permalink
for test
Browse files Browse the repository at this point in the history
  • Loading branch information
sharbelf committed Jul 7, 2013
1 parent 283c41e commit dd1c1b7
Show file tree
Hide file tree
Showing 31 changed files with 118 additions and 18 deletions.
Binary file modified Assets/Scene Fight/CharacterFight.prefab
Binary file not shown.
Binary file modified Assets/Scene Fight/Fight.unity
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Scene Fight/Script/BoxAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void Start () {
_buttons = new GameObject[4];
gameObject.SetActive(false);

_fight = GameObject.Find("/Fight").GetComponent<FightController>();
_fight = Camera.main.GetComponent<FightController>();

}

Expand Down
4 changes: 4 additions & 0 deletions Assets/Scene Fight/Script/BoxCharController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class BoxCharController : MonoBehaviour {
private int _current;

void Start () {

GlobalCharacter.Init();

_character = new GameCharacter[3];

_character = GlobalCharacter.party;
Expand Down Expand Up @@ -41,6 +44,7 @@ private void AddCharToScene(GameCharacter value, int pos)
_itm.transform.position = _positions[pos];
_itm.transform.parent = this.transform;
_itm.GetComponent<CharFightController>().SetCurrent(false);
_itm.GetComponent<CharFightController>().character = value;

charsFight[pos] = _itm;
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scene Fight/Script/BoxEnemiesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public void ShowCharacter()
AddCharToScene(_character[i], i);
}
}

}

private void AddCharToScene(GameCharacter value, int pos)
Expand All @@ -51,6 +50,7 @@ private void AddCharToScene(GameCharacter value, int pos)
_itm.transform.position = _positions[pos];
_itm.transform.parent = this.transform;
_itm.GetComponent<CharFightController>().SetCurrent(false);
_itm.GetComponent<CharFightController>().character = value;

charsFight[pos] = _itm;
}
Expand Down
5 changes: 5 additions & 0 deletions Assets/Scene Fight/Script/ButtonActionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class ButtonActionController : MonoBehaviour {
public GameObject _buttonAction;
public GameObject _buttonSpecial;
public GameObject _buttonItem;
public GameObject _buttonDefense;

private bool _buttonActive;

Expand All @@ -22,6 +23,7 @@ void Start () {
_buttonAction.GetComponent<ButtonAction>().boxAction = _boxAction;
_buttonSpecial.GetComponent<ButtonAction>().boxAction = _boxAction;
_buttonItem.GetComponent<ButtonAction>().boxAction = _boxAction;
_buttonDefense.GetComponent<ButtonAction>().boxAction = _boxAction;


_boxAction.SetActive(false);
Expand All @@ -36,6 +38,7 @@ public void hideButtons()
_buttonAction.SetActive(false);
_buttonSpecial.SetActive(false);
_buttonItem.SetActive(false);
_buttonDefense.SetActive(false);

_buttonActive = false;
}
Expand All @@ -45,6 +48,7 @@ public void showButtons()
_buttonAction.SetActive(true);
_buttonSpecial.SetActive(true);
_buttonItem.SetActive(true);
_buttonDefense.SetActive(true);

_buttonActive = true;
}
Expand All @@ -54,6 +58,7 @@ public void updateButtons()
_buttonAction.GetComponent<ButtonAction>().SetSelected(false);
_buttonSpecial.GetComponent<ButtonAction>().SetSelected(false);
_buttonItem.GetComponent<ButtonAction>().SetSelected(false);
_buttonDefense.GetComponent<ButtonAction>().SetSelected(false);
}


Expand Down
90 changes: 79 additions & 11 deletions Assets/Scene Fight/Script/CharFightAnimation.cs
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;
}
}

10 changes: 9 additions & 1 deletion Assets/Scene Fight/Script/CharFightController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ public class CharFightController : MonoBehaviour {
public bool _selectable;
private FightController _fight;
private GameObject _children;
private GameCharacter _character;

void Start () {
_fight = GameObject.Find("/Fight").GetComponent<FightController>();
_fight = Camera.main.GetComponent<FightController>();
_children = transform.GetChild(0).gameObject;
SetCurrent(false);
}
Expand Down Expand Up @@ -50,4 +51,11 @@ public bool selectable
_selectable = value;
}
}


public GameCharacter character
{
get { return _character; }
set { _character = value; }
}
}
13 changes: 12 additions & 1 deletion Assets/Scene Fight/Script/TimeCounter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ public class TimeCounter : MonoBehaviour {


public GameObject counterBar;
public GameObject _charLife;
public GameObject _charMana;
private GameCharacter _chararcter;

private float _max;
Expand All @@ -29,12 +31,21 @@ public void Update()
}
}

public void UpdateCharData()
{
this.guiText.text = _chararcter.name;
_charLife.guiText.text = _chararcter.attributes.life.ToString();
_charMana.guiText.text = _chararcter.attributes.mana.ToString();
}


public GameCharacter chararcter
{
get { return _chararcter; }
set { _chararcter = value; }
set {
_chararcter = value;
UpdateCharData();
}
}


Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/Game/GameCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class GameCharacter {
private GameItem _leftArm;
private GameItem _rightArm;
private GameAttributes _attributes;
private GameAttributes _base;
private GameAttributes _damage;
private GameItem[] _itens = new GameItem[4];

private GameSkill[] _attacks = new GameSkill[4];
Expand Down Expand Up @@ -37,6 +39,7 @@ public bool EquipItem(GameItem itm)
return false;

}

public void EquipEquipment(GameItem itm, EquipmentType type)
{
switch (type)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Game/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum ActionType
};
public enum ItemList
{
Unknown, Skull = 0, Ring = 1, FullChest = 2, EmptyChest = 3, Cristal = 4, Key = 5, Potion = 6, GreyPotion = 7, BigPotion = 8, LeftHand = 9, RightHand = 10, LeftLeg = 11, RightLeg = 12
Skull = 0, Ring = 1, FullChest = 2, EmptyChest = 3, Cristal = 4, Key = 5, Potion = 6, GreyPotion = 7, BigPotion = 8, LeftHand = 9, RightHand = 10, LeftLeg = 11, RightLeg = 12
};

public enum ActionTextType
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Global/GlobalCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static GameCharacter generetaChar()
GameCharacter _char = new GameCharacter();
_char.attributes = new GameAttributes();
_char.attributes.SetAttributes(10, 10, 10, 10, 10, 100, 50, 10, 1000);
_char.sprite = Random.Range(1, 5);


_char.itens.SetValue(GlobalItens.generateAlchemy(AlchemyType.HealLife), 0);
Expand Down
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file modified Library/assetDatabase3
Binary file not shown.
Binary file modified Library/expandedItems
Binary file not shown.
Binary file modified Library/metadata/10/10390dd9b06cd3940af5f0bcc8d2e98a
Binary file not shown.
Binary file modified Library/metadata/26/26078286b359b7046bbab48e30060a45
Binary file not shown.
Binary file modified Library/metadata/62/62d3ff440d17e454fb6062cd7552c4c4
Binary file not shown.
Binary file modified Library/metadata/6c/6cb0e432902ef00488d583b1b842e6f3
Binary file not shown.
Binary file modified Library/metadata/81/81cde53beca02a848850ec8b2c68233c
Binary file not shown.
Binary file modified Library/metadata/99/999035991fdbece4cba73a3c3a4797dc
Binary file not shown.
Binary file modified Library/metadata/b4/b407c68646841be4e80928022b79b73d
Binary file not shown.
Binary file modified Library/metadata/b9/b93589dedc8e3464da82627801bd9eed
Binary file not shown.
Binary file modified Library/metadata/c7/c72fc8f1a9fbc9647b9aa51824ae590e
Binary file not shown.
Binary file modified Library/metadata/e2/e20c77ee12faeb44b90f4f76891908a3
Binary file not shown.
Binary file modified Library/metadata/ff/fffc659af35c28f48856a29257c796aa
Binary file not shown.
2 changes: 1 addition & 1 deletion RPG-csharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
Expand Down
2 changes: 1 addition & 1 deletion RPG.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
Expand Down

0 comments on commit dd1c1b7

Please sign in to comment.