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

Small changes to test dodge ability.

parent 62bcf526
No related branches found
No related tags found
1 merge request!34Dodge
......@@ -145,11 +145,11 @@ namespace BigSock {
/*
Add Kcockback.
Add Knockback.
*/
//public void KnockBack(float force, Vector2 difference) {
// rb.AddForce(difference * force, ForceMode2D.Impulse);
//}
public void KnockBack(float force, Vector2 difference) {
rb.AddForce(difference * force, ForceMode2D.Impulse);
}
public void KnockBack(IAttackStats attack) {
Vector2 difference = ((Vector2) transform.position - attack.Source).normalized;
//KnockBack(attack.Knockback, difference);
......
fileFormatVersion: 2
guid: 3b098d33750fa314c975d94a25c5b14f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -36,6 +36,7 @@ namespace BigSock {
protected IAttack _testAttack;
protected IAttack _testAttack2;
protected IAbility _dodge;
public DateTime NextTimeCanAttack { get; private set; } = DateTime.Now;
......@@ -58,13 +59,16 @@ namespace BigSock {
//!! DEBUG: Add item to player at start to test if it works.
TryPickUpItem(ItemService.SINGLETON.Get(201));
TryPickUpItem(ItemService.SINGLETON.Get(201));
TryPickUpItem(ItemService.SINGLETON.Get(202));
TryPickUpItem(ItemService.SINGLETON.Get(101));
var tmp = PrefabService.SINGLETON;
//TryPickUpItem(ItemService.SINGLETON.Get(201));
//TryPickUpItem(ItemService.SINGLETON.Get(201));
//TryPickUpItem(ItemService.SINGLETON.Get(202));
//TryPickUpItem(ItemService.SINGLETON.Get(101));
//var tmp = PrefabService.SINGLETON;
_testAttack = (IAttack) AbilityService.SINGLETON.Get(101);
_testAttack2 = (IAttack) AbilityService.SINGLETON.Get(102);
_dodge = AbilityService.SINGLETON.Get(201);
}
......@@ -122,12 +126,20 @@ namespace BigSock {
}
}
// If pressed Z: Big attack.
if(Input.GetKey(KeyCode.Z)) {
_testAttack2.Use(this, Camera.main.ScreenToWorldPoint(Input.mousePosition));
}
// If pressed X: dodge.
if(Input.GetKey(KeyCode.X)) {
_dodge.Use(this, Camera.main.ScreenToWorldPoint(Input.mousePosition));
}
//!! Code for testing the new item stuff.
if(Input.GetKeyDown(KeyCode.Space)) {
if(Input.GetKeyDown(KeyCode.M)) {
var item = ItemService.SINGLETON.GetRandom(); // new ItemRunningShoes();
TryPickUpItem(item);
}
......
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