public void ChangeState(GameZoneActionAssetState stateTo) { if (stateTo != currentCreateState) { currentCreateState = stateTo; } }
public override void Reset() { base.Reset(); actionCompleted = false; actionStarted = false; lastCreateProgress = 0; currentCreateProgress = 0; currentCreateState = GameZoneActionAssetState.none; actionGoalState = GameZoneActionAssetState.none; gameCharacter = null; }
public void Load(string gameZoneTypeTo, string actionCodeTo, string assetCodeTo, string assetPlatformCodeTo) { loaded = false; Reset(); currentCreateState = GameZoneActionAssetState.none; assetCode = assetCodeTo; assetPlatformCode = assetPlatformCodeTo; gameZoneType = gameZoneTypeTo; actionCode = actionCodeTo; Load(); }
public void HandleUpdateAction() { Mathf.Clamp(currentCreateProgress, 0f, 1f); if (!actionCompleted) { bool scoreIt = false; if (isActionCodeBuild || isActionCodeRepair || isActionCodeDefend) { if (currentCreateProgress >= 1) { actionCompleted = true; AssetAnimationIdle(); currentCreateState = GameZoneActionAssetState.created; if (isActionCodeBuild) { scoreIt = true; GameController.CurrentGamePlayerController.ProgressBuild(1); } else if (isActionCodeRepair) { scoreIt = true; AssetEffectRepairPlayNormalizedFlipped(1f); GameController.CurrentGamePlayerController.ProgressRepair(1); } else if (isActionCodeDefend) { scoreIt = true; GameController.CurrentGamePlayerController.ProgressDefend(1); } } } else if (isActionCodeAttack) { float normalizedValue = GetDamageValue() / hitPoints; currentCreateProgress = Mathf.Clamp(normalizedValue, .2f, 1f); AssetAnimationPlayNormalized(currentCreateProgress); AssetEffectRepairPlayNormalizedFlipped(normalizedValue); if (currentCreateProgress <= 0 || normalizedValue == 0) { currentCreateProgress = 0f; actionCompleted = true; ChangeStateDestroying(); scoreIt = true; GameController.CurrentGamePlayerController.ProgressAttack(1); } } if (scoreIt) { GameController.CurrentGamePlayerController.ProgressScore(1); GameController.CurrentGamePlayerController.ProgressScores(1); } if (currentCreateProgress != lastCreateProgress) { lastCreateProgress = currentCreateProgress; if (!actionCompleted) { AssetAnimationPlayNormalized(currentCreateProgress); if (isActionCodeRepair) { AssetEffectRepairPlayNormalizedFlipped(currentCreateProgress); } else if (isActionCodeAttack) { AssetEffectRepairPlayNormalizedFlipped(currentCreateProgress); } } } } }