add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GKCVendorConditionSystem : GKCConditionInfo
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public int vendorObjectAmount;
|
||||
|
||||
public bool useInfiniteVendorAmount;
|
||||
|
||||
public float vendorObjectPrice;
|
||||
|
||||
public float customMoneyChangeSpeed = 20;
|
||||
|
||||
|
||||
public override bool checkIfConditionCompleteAndReturnResult ()
|
||||
{
|
||||
if (!checkIfPlayerAssigned ()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool conditionResult = checkConditionResult ();
|
||||
|
||||
setConditionResult (conditionResult);
|
||||
|
||||
return conditionResult;
|
||||
}
|
||||
|
||||
public override void checkIfConditionComplete ()
|
||||
{
|
||||
if (!checkIfPlayerAssigned ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool conditionResult = checkConditionResult ();
|
||||
|
||||
setConditionResult (conditionResult);
|
||||
}
|
||||
|
||||
bool checkConditionResult ()
|
||||
{
|
||||
bool conditionResult = false;
|
||||
|
||||
playerComponentsManager mainPlayerComponentsManager = currentPlayer.GetComponent<playerComponentsManager> ();
|
||||
|
||||
if (mainPlayerComponentsManager != null) {
|
||||
currencySystem mainCurrencySystem = mainPlayerComponentsManager.getCurrencySystem ();
|
||||
|
||||
if (mainCurrencySystem != null) {
|
||||
bool currentConditionState = true;
|
||||
|
||||
if (mainCurrencySystem.getCurrentMoneyAmount () < vendorObjectPrice) {
|
||||
currentConditionState = false;
|
||||
}
|
||||
|
||||
if (currentConditionState) {
|
||||
if (useInfiniteVendorAmount || vendorObjectAmount > 0) {
|
||||
mainCurrencySystem.increaseTotalMoneyAmount (-vendorObjectPrice, customMoneyChangeSpeed);
|
||||
|
||||
if (!useInfiniteVendorAmount) {
|
||||
vendorObjectAmount--;
|
||||
}
|
||||
} else {
|
||||
currentConditionState = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
conditionResult = currentConditionState;
|
||||
}
|
||||
}
|
||||
|
||||
return conditionResult;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user