|
|
|
@ -260,6 +260,307 @@ public class WeaponManager : Singleton<WeaponManager> |
|
|
|
return gem; |
|
|
|
} |
|
|
|
|
|
|
|
public GameObject getRandomWeaponNodeForPlayerWithLevel(string level) |
|
|
|
{ |
|
|
|
GameObject gem = Instantiate(Resources.Load<GameObject>(Name.WeaponNode.PrefabPath + Name.WeaponNode.PrefabName)); |
|
|
|
string condition = ""; |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
condition= MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerBasicConditionSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerElementaryConditionSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerIntermediateConditionSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
condition = MathTool.GetRandomElements(Name.WeaponNodeCondition.PlayerAdvancedConditionSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
string conditionValue = ""; |
|
|
|
List<string> nodesMark =new List<string>(); |
|
|
|
List<string> nodesColor = new List<string>(); |
|
|
|
string result = ""; |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerBasicResultSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerElementaryResultSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerIntermediateResultSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
result = MathTool.GetRandomElements(Name.WeaponNodeFunction.PlayerAdvancedResultSet, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
string resultValue = ""; |
|
|
|
conditionValue = getConditionValueWithLevel(level, condition, ref nodesMark, ref nodesMark); |
|
|
|
resultValue = getResultValueWithLevel(level, result, condition, conditionValue); |
|
|
|
WeaponNode weaponNode = gem.GetComponent<WeaponNode>(); |
|
|
|
weaponNode.result = result; |
|
|
|
weaponNode.resultValue = resultValue; |
|
|
|
weaponNode.condition = condition; |
|
|
|
weaponNode.conditionValue = conditionValue; |
|
|
|
weaponNode.nodesMark = nodesMark.ToArray(); |
|
|
|
weaponNode.nodesColor = nodesColor.ToArray(); |
|
|
|
return gem; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public string getConditionValueWithLevel(string level,string condition,ref List<string> nodesMark, ref List<string> nodesColor) |
|
|
|
{ |
|
|
|
string conditionValue = ""; |
|
|
|
switch (condition) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeCondition.position: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.positionUnused: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.positionUsed: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.diffSettle: |
|
|
|
conditionValue = Name.none; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.usedCard: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "1", "2", }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "2", "3", }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3", "4", "5" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "4", "5" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.threeColorDiffMoreThan: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "3", "4", "5" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.everyNumNodeConvert: |
|
|
|
conditionValue = MathTool.GetRandomElements(new HashSet<string> { "7", "8", "9" }, 1).ElementAt(0); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GetTargetRange(3,5), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GetTargetRange(4, 6), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GetTargetRange(5, 7), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
conditionValue = MathTool.GetRandomElements(MathTool.GetTargetRange(6, 8), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.bombbomb: |
|
|
|
conditionValue = Name.none; |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.node: |
|
|
|
conditionValue = Name.none; |
|
|
|
HashSet<string> nodesA = new HashSet<string>(); |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
nodesA= MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 2); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 3); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 4); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
nodesA = MathTool.GetRandomElements(new HashSet<string> { "1_0", "-1_0", "0_1", "0_-1", "-1_1", "-1_-1" }, 5); |
|
|
|
break; |
|
|
|
} |
|
|
|
nodesA.Add("0_0"); |
|
|
|
nodesMark = nodesA.ToList(); |
|
|
|
for (int i = 0; i < nodesA.Count; i++) |
|
|
|
{ |
|
|
|
nodesColor.Add(MathTool.GetRandomElements(new HashSet<string> { Name.Color.Red, Name.Color.Blue, Name.Color.Yellow }, 1).ElementAt(0)); |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeCondition.cardConditionPattern: |
|
|
|
conditionValue = Name.none; |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
sb.Append(MathTool.GetRandomElements(new HashSet<string> { Name.Color.Red, Name.Color.Blue, Name.Color.Yellow }, 1).ElementAt(0)) |
|
|
|
.Append(MathTool.GetRandomElements(new HashSet<string> { "<", ">" }, 1).ElementAt(0)); |
|
|
|
string part3 = ""; |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GetTargetRange(3, 5), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GetTargetRange(5, 8), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GetTargetRange(9, 12), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
part3 = MathTool.GetRandomElements(MathTool.GetTargetRange(14, 18), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
sb.Append(part3); |
|
|
|
condition = sb.ToString(); |
|
|
|
break; |
|
|
|
} |
|
|
|
return conditionValue; |
|
|
|
} |
|
|
|
|
|
|
|
public string getResultValueWithLevel(string level, string result,string condition,string conditionValue) |
|
|
|
{ |
|
|
|
string resultValue = ""; |
|
|
|
switch (result) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeFunction.addScore: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(5, 7), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(8, 12), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(13, 18), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(23, 30), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.mulScore: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(1, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 6), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.repetWeaponNode: |
|
|
|
resultValue = MathTool.GetRandomElements(new HashSet<string> { "0", "1", "2", "3", "4" }, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.redNodeCount: |
|
|
|
case Name.WeaponNodeFunction.blueNodeCount: |
|
|
|
case Name.WeaponNodeFunction.yellowNodeCount: |
|
|
|
case Name.WeaponNodeFunction.mostNodeCount: |
|
|
|
case Name.WeaponNodeFunction.leastNodeCount: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 7), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 12), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(14, 18), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(20, 25), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.allNodeCount: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(2, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 6), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(7, 9), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(10, 12), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.drawCard: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(1, 2), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(2, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 5), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.everyRedNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.everyYellowNodeAddScore: |
|
|
|
case Name.WeaponNodeFunction.everyBlueNodeAddScore: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(1, 1), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(2, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 5), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(6, 8), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.NodeItem.Volcano: |
|
|
|
switch (level) |
|
|
|
{ |
|
|
|
case Name.WeaponNodeLevel.Basic: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(1, 1), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Elementary: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(2, 2), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Intermediate: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(3, 3), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
case Name.WeaponNodeLevel.Advanced: |
|
|
|
resultValue = MathTool.GetRandomElements(MathTool.GenerateIntegerSet(4, 4), 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
break; |
|
|
|
case Name.WeaponNodeFunction.isIgnoreCondition: |
|
|
|
HashSet<string> targets= MathTool.GenerateIntegerSet(0, 4); |
|
|
|
if(condition.Equals(Name.WeaponNodeCondition.positionUnused)|| condition.Equals(Name.WeaponNodeCondition.positionUsed)) |
|
|
|
{ |
|
|
|
targets.Remove(conditionValue); |
|
|
|
} |
|
|
|
resultValue = MathTool.GetRandomElements(targets, 1).ElementAt(0); |
|
|
|
break; |
|
|
|
} |
|
|
|
return resultValue; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void loadEnemyWeaponNode(int position,GameObject weaponNode) |
|
|
|
{ |
|
|
|
|