Skip to content
Snippets Groups Projects
Commit 21610287 authored by Robin Halseth Sandvik's avatar Robin Halseth Sandvik
Browse files

Updated to use the new paramers.

parent 8056b083
No related branches found
No related tags found
1 merge request!53ToolTips, new ability parameter system & misc clean ups.
...@@ -34,6 +34,7 @@ namespace BigSock { ...@@ -34,6 +34,7 @@ namespace BigSock {
protected IAttack _testAttack; protected IAttack _testAttack;
protected IAttack _testAttack2; protected IAttack _testAttack2;
protected IAbility _dodge; protected IAbility _dodge;
...@@ -118,30 +119,32 @@ namespace BigSock { ...@@ -118,30 +119,32 @@ namespace BigSock {
} }
private void Update() { private void Update() {
// Regenerate mana & stamina.
Regenerate(); Regenerate();
if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButton(0)) { // Object w/ parameters for abilities.
// Manage attack cooldown. var par = new AbilityParam{
if(NextTimeCanAttack <= DateTime.Now) { Actor = this,
//NextTimeCanAttack = DateTime.Now.AddSeconds(AttackCooldown); TargetPos = Camera.main.ScreenToWorldPoint(Input.mousePosition),
MovementDir = moveDir,
};
//var bullet = Instantiate(attack, new Vector3(transform.position.x, transform.position.y, transform.position.z), attack.transform.rotation);
//bullet.GetComponent<AttackMovement>().Actor = this;
_testAttack.Use(this, Camera.main.ScreenToWorldPoint(Input.mousePosition)); // If pressed Soace or LMB: Regular attack.
if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButton(0)) {
} _testAttack.Use(par);
} }
// If pressed Z: Big attack. // If pressed Z: Big attack.
if(Input.GetKey(KeyCode.Z)) { if(Input.GetKey(KeyCode.Z)) {
_testAttack2.Use(this, Camera.main.ScreenToWorldPoint(Input.mousePosition)); _testAttack2.Use(par);
} }
// If pressed X: dodge. // If pressed X: dodge.
if(Input.GetKey(KeyCode.X)) { if(Input.GetKey(KeyCode.X)) {
_dodge.Use(this, Camera.main.ScreenToWorldPoint(Input.mousePosition)); _dodge.Use(par);
} }
...@@ -152,9 +155,8 @@ namespace BigSock { ...@@ -152,9 +155,8 @@ namespace BigSock {
TryPickUpItem(item); TryPickUpItem(item);
} }
// Code for opening the menu.
if (Input.GetKeyDown(KeyCode.I)) if (Input.GetKeyDown(KeyCode.I)) {
{
GameObject canvas = GameObject.Find("Canvas"); GameObject canvas = GameObject.Find("Canvas");
if(canvas != null) { if(canvas != null) {
var playerMenu = PrefabService.SINGLETON.Instance("UI/PlayerMenu", canvas.transform); var playerMenu = PrefabService.SINGLETON.Instance("UI/PlayerMenu", canvas.transform);
......
...@@ -71,7 +71,16 @@ namespace BigSock { ...@@ -71,7 +71,16 @@ namespace BigSock {
m_Animator_bow.SetTrigger("attack"); m_Animator_bow.SetTrigger("attack");
if(DateTime.Now >= NextTimeStateCanChange && target != null) { if(DateTime.Now >= NextTimeStateCanChange && target != null) {
m_Animator_bow.SetTrigger("none"); m_Animator_bow.SetTrigger("none");
_testAttack.Use(this, target.position);
// Object w/ parameters for abilities.
var par = new AbilityParam{
Actor = this,
TargetPos = target.position,
MovementDir = moveDir,
};
_testAttack.Use(par);
State = State.Attacking; State = State.Attacking;
NextTimeStateCanChange = DateTime.Now + ATTACK_WAIT_TIME; NextTimeStateCanChange = DateTime.Now + ATTACK_WAIT_TIME;
......
...@@ -71,7 +71,14 @@ namespace BigSock { ...@@ -71,7 +71,14 @@ namespace BigSock {
if(DateTime.Now >= NextTimeStateCanChange && target != null) { if(DateTime.Now >= NextTimeStateCanChange && target != null) {
_testAttack.Use(this, target.position); // Object w/ parameters for abilities.
var par = new AbilityParam{
Actor = this,
TargetPos = target.position,
MovementDir = moveDir,
};
_testAttack.Use(par);
State = State.Attacking; State = State.Attacking;
NextTimeStateCanChange = DateTime.Now + ATTACK_WAIT_TIME; NextTimeStateCanChange = DateTime.Now + ATTACK_WAIT_TIME;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment