Skip to content

Commit

Permalink
Merge branch 'Develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierolivenza committed Apr 23, 2018
2 parents 667ac29 + 32b89dd commit 4bde7c6
Show file tree
Hide file tree
Showing 1,313 changed files with 1,258,178 additions and 5,252 deletions.
18 changes: 13 additions & 5 deletions CulverinEditor/CulverinEditor/AI/Actions/Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum ACTION_TYPE
IDLE_ATTACK_ACTION,
INVESTIGATE_ACTION,
CHASE_ACTION,
INFINITE_CHASE_ACTION,
SEPARATE_ACTION,
FACE_PLAYER_ACTION,
PUSHBACK_ACTION,
Expand All @@ -30,29 +31,36 @@ public enum ACTION_TYPE
SHIELD_BLOCK_ACTION,
ENGAGE_ACTION,
DISENGAGE_ACTION,
DIE_ACTION
DIE_ACTION,
BOSS_ATTACK_SWORD_DOWN_ACTION,
BOSS_ATTACK_WIDE_ACTION,
BOSS_ATTACK_STRONG_ACTION,
BOSS_ATTACK_GRAB_ACTION,
BOSS_ENGAGE_ACTION
}

public ACTION_TYPE action_type = ACTION_TYPE.NO_ACTION;

public Action()
{}
{
action_type = ACTION_TYPE.NO_ACTION;
}

public virtual bool ActionStart()
{
Debug.Log("Action start not defined!");
Debug.Log("[error] Action start not defined!");
return false;
}

public virtual ACTION_RESULT ActionUpdate()
{
Debug.Log("Action update not defined!");
Debug.Log("[error] Action update not defined!");
return ACTION_RESULT.AR_FAIL;
}

public virtual bool ActionEnd()
{
Debug.Log("Action end not defined!");
Debug.Log("[error] Action end not defined!");
interupt = false;
return false;
}
Expand Down
3 changes: 0 additions & 3 deletions CulverinEditor/CulverinEditor/AI/Actions/Align_Steering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class Align_Steering : CulverinBehaviour
void Start()
{
move = GetComponent<Movement_Action>();
Debug.Log("Align Start");
SetEnabled(false);
}

Expand All @@ -32,8 +31,6 @@ void Update()
}

move.Rotate(Mathf.Rad2deg(acceleration));

//Debug.Log("Delta: " + delta);
}

public void SetRotation(float delta)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class Arrive_Steering : CulverinBehaviour
// Use this for initialization
void Start()
{
Debug.Log("Arrive Start");
in_range = false;
SetEnabled(false);
move = GetComponent<Movement_Action>();
Expand Down
17 changes: 5 additions & 12 deletions CulverinEditor/CulverinEditor/AI/Actions/Attack_Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ public override bool ActionStart()
{
player = GetLinkedObject("target").GetComponent<CharactersManager>();
if (player == null)
{
Debug.Log("[error]Attack Action Start: Player is null!!");
}
Debug.Log("[error] Attack Action Start: Player is null!");


Debug.Log("Starting attack");
GetComponent<CompAnimation>().SetTransition("ToAttack");
GetComponent<CompAnimation>().SetClipDuration("Attack", attack_duration);

GetComponent<CompAnimation>().PlayAnimationNode("Attack");
GetComponent<CompAudio>().PlayEvent("Enemy1_Slash");


Expand All @@ -59,19 +56,15 @@ public override ACTION_RESULT ActionUpdate()
if (player.GetDamage(damage) == true)
{
GetComponent<CompAudio>().PlayEvent("SwordHit");
GetComponent<CompAnimation>().SetActiveBlendingClipWeight(0.0f);
GetComponent<CompAnimation>().SetFirstActiveBlendingClipWeight(0.0f);
}
else
GetComponent<CompAnimation>().SetActiveBlendingClipWeight(1.0f);
GetComponent<CompAnimation>().SetFirstActiveBlendingClipWeight(1.0f);
}
}

if (GetComponent<CompAnimation>().IsAnimationStopped("Attack"))
{
Debug.Log("Attack end");
return ACTION_RESULT.AR_SUCCESS;
}

return ACTION_RESULT.AR_IN_PROGRESS;
}

Expand Down
114 changes: 114 additions & 0 deletions CulverinEditor/CulverinEditor/AI/Actions/BossAttackSwordDown_Action.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
using CulverinEditor.Debug;
using CulverinEditor;

public class BossAttackSwordDown_Action : Action
{
public BossAttackSwordDown_Action()
{
action_type = ACTION_TYPE.BOSS_ATTACK_SWORD_DOWN_ACTION;
}

public BossAttackSwordDown_Action(float dmg)
{
action_type = ACTION_TYPE.BOSS_ATTACK_SWORD_DOWN_ACTION;
damage = dmg;
}

public enum BASD_STATE
{
WAITING,
PRE_APPLY,
POST_APPLY
}

BASD_STATE state = BASD_STATE.WAITING;
public float damage = 1.0f;
public float apply_damage_point = 0.5f;
public float hit_ground_point = 0.6f;
public float preparation_time = 0.8f;
public float attack_duration = 1.0f;

public float rumble_power = 0.5f;
public int rumble_time = 200;
private bool ground_hit = true;


public override bool ActionStart()
{

state = BASD_STATE.PRE_APPLY;
GetComponent<CompAnimation>().SetTransition("ToSwordDownAttack");
GetComponent<CompAnimation>().SetClipDuration("SwordDownAttack", preparation_time / apply_damage_point);
GetComponent<CompAudio>().PlayEvent("AttackPreparation");
ground_hit = true;
return true;
}

public override ACTION_RESULT ActionUpdate()
{
if (state == BASD_STATE.PRE_APPLY && GetComponent<CompAnimation>().IsAnimOverXTime(apply_damage_point))
{
GetComponent<CompAnimation>().SetClipDuration("SwordDownAttack", (attack_duration / (1.0f - apply_damage_point)));

state = BASD_STATE.POST_APPLY;

int enemy_tile_x = GetComponent<Movement_Action>().GetCurrentTileX();
int enemy_tile_y = GetComponent<Movement_Action>().GetCurrentTileY();

GetLinkedObject("player_obj").GetComponent<MovementController>().GetPlayerPos(out int player_tile_x, out int player_tile_y);

switch (GetComponent<Movement_Action>().GetDirection())
{
case Movement_Action.Direction.DIR_WEST:
if ((enemy_tile_x - 1 == player_tile_x || enemy_tile_x - 2 == player_tile_x) && player_tile_y == enemy_tile_y)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
ground_hit = false;
}
break;
case Movement_Action.Direction.DIR_EAST:
if ((enemy_tile_x + 1 == player_tile_x || enemy_tile_x + 2 == player_tile_x) && player_tile_y == enemy_tile_y)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
ground_hit = false;
}
break;
case Movement_Action.Direction.DIR_NORTH:
if ((enemy_tile_y - 1 == player_tile_y || enemy_tile_y - 2 == player_tile_y) && player_tile_x == enemy_tile_x)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
ground_hit = false;
}
break;
case Movement_Action.Direction.DIR_SOUTH:
if ((enemy_tile_y + 1 == player_tile_y || enemy_tile_y + 2 == player_tile_y) && player_tile_x == enemy_tile_x)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
ground_hit = false;
}
break;
}
}
else if (ground_hit == true && GetComponent<CompAnimation>().IsAnimOverXTime(hit_ground_point))
{
GetComponent<CompAudio>().PlayEvent("BossHitGround");
Input.RumblePlay(rumble_power, rumble_time);
ground_hit = false;
Debug.Log("Ground Hit!!");
}
else if (state == BASD_STATE.POST_APPLY && GetComponent<CompAnimation>().IsAnimationStopped("SwordDownAttack"))
{

state = BASD_STATE.WAITING;
return ACTION_RESULT.AR_SUCCESS;
}
return ACTION_RESULT.AR_IN_PROGRESS;
}

public override bool ActionEnd()
{
Debug.Log("SwordDown attack end!");
interupt = false;
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using CulverinEditor.Debug;
using CulverinEditor;

public class BossBasicStrongAttack_Action : Action
{
public BossBasicStrongAttack_Action()
{
action_type = ACTION_TYPE.BOSS_ATTACK_STRONG_ACTION;
}

public BossBasicStrongAttack_Action(float dmg)
{
action_type = ACTION_TYPE.BOSS_ATTACK_STRONG_ACTION;
damage = dmg;
}

public enum BSA_STATE
{
WAITING,
PRE_APPLY,
POST_APPLY
}

BSA_STATE state = BSA_STATE.WAITING;
public float damage = 1.0f;
public float apply_damage_point = 0.5f;
public float attack_duration = 1.0f;


public override bool ActionStart()
{
state = BSA_STATE.PRE_APPLY;
GetComponent<CompAnimation>().SetTransition("ToAttack");
GetComponent<CompAnimation>().SetClipDuration("Attack", attack_duration);
GetComponent<CompAudio>().PlayEvent("AttackPreparation");
return true;
}

public override ACTION_RESULT ActionUpdate()
{
if (state == BSA_STATE.PRE_APPLY && GetComponent<CompAnimation>().IsAnimOverXTime(apply_damage_point))
{
state = BSA_STATE.POST_APPLY;

int enemy_tile_x = GetComponent<Movement_Action>().GetCurrentTileX();
int enemy_tile_y = GetComponent<Movement_Action>().GetCurrentTileY();

GetLinkedObject("player_obj").GetComponent<MovementController>().GetPlayerPos(out int player_tile_x, out int player_tile_y);

switch (GetComponent<Movement_Action>().GetDirection())
{
case Movement_Action.Direction.DIR_WEST:
if (enemy_tile_x - 1 == player_tile_x && player_tile_y == enemy_tile_y)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
}
break;
case Movement_Action.Direction.DIR_EAST:
if (enemy_tile_x + 1 == player_tile_x && player_tile_y == enemy_tile_y)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
}
break;
case Movement_Action.Direction.DIR_NORTH:
if (enemy_tile_y - 1 == player_tile_y && player_tile_x == enemy_tile_x)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
}
break;
case Movement_Action.Direction.DIR_SOUTH:
if (enemy_tile_y + 1 == player_tile_y && player_tile_x == enemy_tile_x)
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().GetDamage(damage);
}
break;
}
}
else if (state == BSA_STATE.POST_APPLY && GetComponent<CompAnimation>().IsAnimationStopped("Attack"))
{

state = BSA_STATE.WAITING;
return ACTION_RESULT.AR_SUCCESS;
}
return ACTION_RESULT.AR_IN_PROGRESS;
}

public override bool ActionEnd()
{
Debug.Log("Strong basic attack end!");
interupt = false;
return false;
}
}
49 changes: 49 additions & 0 deletions CulverinEditor/CulverinEditor/AI/Actions/BossEngage_Action.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using CulverinEditor;
using CulverinEditor.Debug;

class BossEngage_Action : Action
{
public float duration = 1.0f;
bool play_audio = false;

public BossEngage_Action()
{
action_type = ACTION_TYPE.BOSS_ENGAGE_ACTION;
}

public override bool ActionStart()
{
GetLinkedObject("player_obj").GetComponent<CharactersManager>().SetCurrentCharacterState(CharacterController.State.GRABBED);
GetComponent<CompAnimation>().SetTransition("ToDraw");
GetComponent<CompAnimation>().SetClipDuration("Draw", duration);
return true;
}

public override ACTION_RESULT ActionUpdate()
{
if (GetComponent<CompAnimation>().IsAnimOverXTime(0.2f) && play_audio == false)
{
GetComponent<CompAudio>().PlayEvent("Enemy_SwordDraw");
play_audio = true;
}

if (GetComponent<CompAnimation>().IsAnimationStopped("Draw"))
return ACTION_RESULT.AR_SUCCESS;
return ACTION_RESULT.AR_IN_PROGRESS;
}

public override bool ActionEnd()
{
Debug.Log("Combat starts");
GetLinkedObject("player_obj").GetComponent<CharactersManager>().SetCurrentCharacterState(CharacterController.State.IDLE);
interupt = false;
play_audio = false;
GetLinkedObject("hp_bar_boss").SetActive(true);
GetLinkedObject("hp_bar_boss").GetComponent<BossHPBar>().ActivateHPBar(true);
Audio.ChangeState("MusicState", "FinalBoss");

return true;
}


}
Loading

0 comments on commit 4bde7c6

Please sign in to comment.