public void InitializeBar(ActorStat statInfo) { battleStatType = statInfo.actorStatType; barStyle = battleBarStyles[(int)battleStatType]; ratioText.color = barStyle.textNormalColor; barBG.color = barStyle.baseColor; fullBar.color = barStyle.fullColor; nameplate.text = statInfo.name + " " + statInfo.tmpIconText; battleStatInfo = statInfo; UpdateState(); }
public void InjectData(RPGActorData data) { actorData = data; name = actorData.actorName; battleStats = new Dictionary <ActorStatType, ActorStat>(); battleStats[ActorStatType.HP] = ActorStat.CreateBattleStat(ActorStatType.HP, "HP", data.hp); battleStats[ActorStatType.MP] = ActorStat.CreateBattleStat(ActorStatType.MP, "MP", data.mp); battleStats[ActorStatType.SPD] = ActorStat.CreateBattleStat(ActorStatType.SPD, "SPD", data.speed); battleStats[ActorStatType.STAM] = ActorStat.CreateBattleStat(ActorStatType.STAM, "STM", data.stamina); battleStats[ActorStatType.ABP] = ActorStat.CreateBattleStat(ActorStatType.ABP, "ABP", 100); battleStats[ActorStatType.ABP].currentScore = 0; statList = new List <ActorStat>(); statList.AddRange(battleStats.Values); // @TODO add BattleActorCommands to battleCommandHolder foreach (string commandName in data.commands) { if (string.IsNullOrEmpty(commandName)) { continue; } CommandData commandData = MasterCommandList.GetCommandData(this, commandName); regularCommands.Add(commandData); } movementFSM = new MovementFSM <BattleActor>(this, actorAnimator); movementFSM.AddState(MovementStateType.GroundMovement, new GroundMovementState(this)); actionFSM = new ActionFSM <BattleActor>(this, actorAnimator); actionFSM.AddState(ActionType.Stand, new NeutralAction(this)); actionFSM.AddState(ActionType.Fight, new FightCommandAction(this)); actorAnimator = GetComponent <ActorAnimator>(); actorAnimator.SetAnimatorController(data); //if (data.isPlayerCharacter) { gameObject.tag = Tags.PC; actorAnimator.AddAnimations(ActionAnimationState.Neutral, false); actorAnimator.AddAnimations(ActionAnimationState.Walk, false); actorAnimator.AddAnimations(ActionAnimationState.MainAttack, false); actorAnimator.AddAnimations(ActionAnimationState.OffHandAttack, false); actorAnimator.AddAnimations(ActionAnimationState.SpellCharge, false); actorAnimator.AddAnimations(ActionAnimationState.SpellCast, false); actorAnimator.AddAnimations(ActionAnimationState.Guard, false); } //else //{ // battleManager.battleHUD.AddNPCToPanel(name); // gameObject.tag = Tags.NPC; //} actorAnimator.SetAnimationState(ActionAnimationState.Neutral, currentFacing); var sprite = GetComponent <SpriteRenderer>(); var collider = GetComponent <CapsuleCollider2D>(); collider.offset = new Vector2(0, 0); collider.size = new Vector3(sprite.bounds.size.x / transform.lossyScale.x, sprite.bounds.size.y / transform.lossyScale.y, sprite.bounds.size.z / transform.lossyScale.z); }
public NeutralAction(BattleActor owner) : base(owner, ActionType.Stand) { abpStat = owner.GetStat(ActorStatType.ABP); spdStat = owner.GetStat(ActorStatType.SPD); }