public List <Tip> GetAllTipConcerningGroups(GroupMonsterFighter groupMonster, GroupHumanFighter groupHuman, bool inInitialGroup) { List <Tip> finalList = new List <Tip>(); List <Fighter> allHuman = groupHuman.lFighters; List <Fighter> allMonster = groupMonster.lFighters; if (inInitialGroup) { allHuman = groupHuman.lInitialFighters; allMonster = groupMonster.lInitialFighters; } foreach (Tip tip in tipsNotKnownByPlayer) { bool bConcernM = false; bool bConcernH = false; foreach (Fighter fighter in allHuman) { ModelHumainUI modelH = ((Human)fighter).currentUI.gameObject.GetComponentInChildren <ModelHumainUI>(); CaractHumainCheveux cheveux = modelH.caractCheveux; CaractHumainStuff stuff = modelH.caractStuff; if (tip.caracHumain == cheveux) { bConcernH = true; } else if (tip.caracHumain == stuff) { bConcernH = true; } } foreach (Fighter fighter in allMonster) { ModelMonsterUI modelM = ((Monster)fighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); if (modelM != null) { CaractMonster firstMutation = modelM.caractMonster; CaractMonster permaMutation = modelM.permanentCarMutation; if (tip.caracMonster == firstMutation) { bConcernM = true; } else if (tip.caracMonster == permaMutation) { bConcernM = true; } } } if (bConcernH && bConcernM) { finalList.Add(tip); } } return(finalList); }
// Update is called once per frame void Update() { if (currentFighter != cm.currentFighter) { currentFighter = cm.currentFighter; foreach (Transform child in currentMeshHolder.transform) { Destroy(child.gameObject); } if (currentFighter.eCreatureType == CreatureType.Human) { currentMeshHolder.transform.position = positionHuman.transform.position; // GameObject gHuman = prefabManager.GetHuman(currentFighter.nID); GameObject gHuman = prefabManager.GetHumanOfSex(currentFighter.nID, currentFighter.sexe); int layer = LayerMask.NameToLayer("UI"); ModelHumainUI modelUI = gHuman.GetComponent <ModelHumainUI>(); ModelHumainUI modelCurrent = ((Human)currentFighter).currentUI.gameObject.GetComponentInChildren <ModelHumainUI>(); modelUI.SetCaract(modelCurrent.caractCheveux); GameObject instanceHuman = Instantiate(gHuman, Vector3.zero, Quaternion.Euler(0, 90, 0)) as GameObject; instanceHuman.transform.parent = currentMeshHolder.transform; instanceHuman.transform.localPosition = Vector3.zero; instanceHuman.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); } else { currentMeshHolder.transform.position = positionMonster.transform.position; GameObject gMonster = prefabManager.GetMonster(currentFighter.nID); ModelMonsterUI modelUI = gMonster.GetComponent <ModelMonsterUI>(); ModelMonsterUI modelCurrent = ((Monster)currentFighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); modelUI.SetCaract(modelCurrent.caractMonster); GameObject instanceMonster = Instantiate(gMonster, Vector3.zero, Quaternion.Euler(0, 90, 0)) as GameObject; instanceMonster.transform.parent = currentMeshHolder.transform; instanceMonster.transform.localPosition = Vector3.zero; instanceMonster.transform.localScale = new Vector3(-0.5f, 0.5f, 0.5f); } } if (cm.bCombatEnded && !processedEnd) { processedEnd = true; if (cm.bSpecialFight && cm.specialType == SpecialType.Bard) { foreach (Transform child in currentMeshHolder.transform) { Destroy(child.gameObject); } currentMeshHolder.transform.position = positionHuman.transform.position; GameObject gHuman = prefabManager.GetSpecial(31); // ModelHumainUI modelUI = gHuman.GetComponent<ModelHumainUI>(); // ModelHumainUI modelCurrent = ((Human)currentFighter).currentUI.gameObject.GetComponentInChildren<ModelHumainUI>(); // modelUI.SetCaract(modelCurrent.caractCheveux); GameObject instanceHuman = Instantiate(gHuman, Vector3.zero, Quaternion.Euler(0, 90, 0)) as GameObject; instanceHuman.transform.parent = currentMeshHolder.transform; instanceHuman.transform.localPosition = Vector3.zero; instanceHuman.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); } } if (talk.active == true) { currentMeshHolder.SetActive(true); foreach (Transform child in currentMeshHolder.transform) { child.gameObject.SetActive(true); } } else { foreach (Transform child in currentMeshHolder.transform) { child.gameObject.SetActive(false); } } }
public float GetBonus(ActionType actionType, Monster monster, GroupHumanFighter groupHuman) { float bonus = 0; List <Tip> myTips = GetTipsOfAction(actionType, monster.eCreatureType); CaractMonster cm = monster.currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>().caractMonster; myTips = GetTipsAboutMonsterCarac(cm, myTips); foreach (Fighter fighter in groupHuman.lFighters) { if (fighter.CanAttack()) { ModelHumainUI modelH = ((Human)fighter).currentUI.gameObject.GetComponentInChildren <ModelHumainUI>(); CaractHumainCheveux cheveux = modelH.caractCheveux; CaractHumainStuff stuff = modelH.caractStuff; foreach (Tip tip in myTips) { if (tip.caracHumain == cheveux) { bonus += tip.modroll.GetValueOfAction(actionType, monster.eCreatureType); } else if (tip.caracHumain == stuff) { bonus += tip.modroll.GetValueOfAction(actionType, monster.eCreatureType); } if (bonus != 0) { break; } } } if (bonus != 0) { break; } } myTips = GetTipsOfAction(actionType, monster.eCreatureType); cm = monster.currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>().permanentCarMutation; myTips = GetTipsAboutMonsterCarac(cm, myTips); foreach (Fighter fighter in groupHuman.lFighters) { if (fighter.CanAttack()) { ModelHumainUI modelH = ((Human)fighter).currentUI.gameObject.GetComponentInChildren <ModelHumainUI>(); CaractHumainCheveux cheveux = modelH.caractCheveux; CaractHumainStuff stuff = modelH.caractStuff; foreach (Tip tip in myTips) { if (tip.caracHumain == cheveux) { bonus += tip.modroll.GetValueOfAction(actionType, monster.eCreatureType); } else if (tip.caracHumain == stuff) { bonus += tip.modroll.GetValueOfAction(actionType, monster.eCreatureType); } if (bonus != 0) { break; } } } if (bonus != 0) { break; } } // CaractMonster mutation; return(bonus); }
void InstantiateHuman() { GameObject prefab = prefabHuman; Fighter fighter; CreatureType creatureType = CreatureType.Human; GameObject humansPositionParent = GameObject.FindGameObjectWithTag("HumansPosition"); List <Transform> humansPosition = new List <Transform>(); foreach (Transform child in humansPositionParent.transform) { humansPosition.Add(child); } if (!bSpecialFight) { humanGroupFighter = new GroupHumanFighter(); if (protoScript == null && !isBossCombat) { currentNbHuman = Random.Range(2, nbCreaturePerGroup + 1); //currentNbHuman = 2; } for (int i = 0; i < currentNbHuman; i++) { int idModel = creaturePrefabManager.GetRandomHumanID(); GameObject model = creaturePrefabManager.GetHuman(idModel); Human humain = GameObject.FindGameObjectWithTag("CreaturesData").GetComponent <CreaturesData>().GetFighterOfID <Human>(creatureType, idModel); humain.sexe = enumSex.None; enumSex sexCurrent = creaturePrefabManager.GetSexPrefabId(model, idModel); humain.sexe = sexCurrent; ModelHumainUI modelUI = model.GetComponent <ModelHumainUI>(); if (modelUI != null) { modelUI.RandomCheveux(); } if (humain == null) { humain = new Human(); humain.CopyHuman(defaultHuman); humain.nID = idModel; //humain.sName = model.name; } GameObject g = Instantiate(prefab, humansPosition[i].position, Quaternion.Euler(0, 90, 0)) as GameObject; GameObject mo = Instantiate(model, humansPosition[i].position, Quaternion.Euler(0, 90, 0)) as GameObject; mo.transform.parent = g.transform; mo.transform.localPosition = Vector3.zero; mo.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); mo.transform.GetChild(0).gameObject.AddComponent <BoxCollider>(); MouseOverCreature mouseOver = mo.transform.GetChild(0).gameObject.AddComponent <MouseOverCreature>(); mouseOver.fighterUI = g.GetComponent <FighterUI>(); g.GetComponent <FighterUI>().fighter = humain; humanGroupFighter.lFighters.Add(humain); g.transform.parent = GameObject.FindGameObjectWithTag("Humans").transform; g.name = humain.sName; g.GetComponent <FighterUI>().fighterRenderer = mouseOver.gameObject.GetComponent <Renderer>(); } } else { if (specialType == SpecialType.Ed) { humanGroupFighter = new GroupEd(); int idModel = 30; GameObject model = creaturePrefabManager.GetSpecial(idModel); //Human humain = GameObject.FindGameObjectWithTag("CreaturesData").GetComponent<CreaturesData>().GetFighterOfID<Human>(creatureType, idModel); Human humain = new Human(); humain.CopyHuman(defaultHuman); humain.nID = idModel; humain.sName = "Ed"; humain.nPower = GameObject.FindGameObjectWithTag("CreaturesData").GetComponent <CreaturesData>().defaultHuman.nPower; GameObject g = Instantiate(prefab, humansPosition[0].position, Quaternion.Euler(0, 90, 0)) as GameObject; GameObject mo = Instantiate(model, humansPosition[0].position, Quaternion.Euler(0, 90, 0)) as GameObject; mo.transform.parent = g.transform; mo.transform.localPosition = Vector3.zero; mo.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); mo.transform.GetChild(0).gameObject.AddComponent <BoxCollider>(); MouseOverCreature mouseOver = mo.transform.GetChild(0).gameObject.AddComponent <MouseOverCreature>(); mouseOver.fighterUI = g.GetComponent <FighterUI>(); g.GetComponent <FighterUI>().fighter = humain; humanGroupFighter.lFighters.Add(humain); g.transform.parent = GameObject.FindGameObjectWithTag("Humans").transform; g.name = humain.sName; g.GetComponent <FighterUI>().fighterRenderer = mouseOver.gameObject.GetComponent <Renderer>(); } if (specialType == SpecialType.Bard) { humanGroupFighter = new GroupBard(); int idModel = 31; GameObject model = creaturePrefabManager.GetSpecial(idModel); //Human humain = GameObject.FindGameObjectWithTag("CreaturesData").GetComponent<CreaturesData>().GetFighterOfID<Human>(creatureType, idModel); Human humain = new Human(); humain.CopyHuman(defaultHuman); humain.nID = idModel; humain.sName = "Bard"; GameObject g = Instantiate(prefab, humansPosition[0].position, Quaternion.Euler(0, 90, 0)) as GameObject; GameObject mo = Instantiate(model, humansPosition[0].position, Quaternion.Euler(0, 90, 0)) as GameObject; mo.transform.parent = g.transform; mo.transform.localPosition = Vector3.zero; mo.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); mo.transform.GetChild(0).gameObject.AddComponent <BoxCollider>(); MouseOverCreature mouseOver = mo.transform.GetChild(0).gameObject.AddComponent <MouseOverCreature>(); mouseOver.fighterUI = g.GetComponent <FighterUI>(); g.GetComponent <FighterUI>().fighter = humain; humanGroupFighter.lFighters.Add(humain); g.transform.parent = GameObject.FindGameObjectWithTag("Humans").transform; g.name = humain.sName; g.GetComponent <FighterUI>().fighterRenderer = mouseOver.gameObject.GetComponent <Renderer>(); } if (specialType == SpecialType.Slip) { humanGroupFighter = new GroupSlip(); int idModel = 32; GameObject model = creaturePrefabManager.GetSpecial(idModel); //Human humain = GameObject.FindGameObjectWithTag("CreaturesData").GetComponent<CreaturesData>().GetFighterOfID<Human>(creatureType, idModel); Human humain = new Human(); humain.CopyHuman(defaultHuman); humain.nPower = 0; humain.nID = idModel; humain.sName = "MecEnSlip"; GameObject g = Instantiate(prefab, humansPosition[0].position, Quaternion.Euler(0, 90, 0)) as GameObject; GameObject mo = Instantiate(model, humansPosition[0].position, Quaternion.Euler(0, 90, 0)) as GameObject; mo.transform.parent = g.transform; mo.transform.localPosition = Vector3.zero; mo.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); mo.transform.GetChild(0).gameObject.AddComponent <BoxCollider>(); MouseOverCreature mouseOver = mo.transform.GetChild(0).gameObject.AddComponent <MouseOverCreature>(); mouseOver.fighterUI = g.GetComponent <FighterUI>(); g.GetComponent <FighterUI>().fighter = humain; humanGroupFighter.lFighters.Add(humain); g.transform.parent = GameObject.FindGameObjectWithTag("Humans").transform; g.name = humain.sName; g.GetComponent <FighterUI>().fighterRenderer = mouseOver.gameObject.GetComponent <Renderer>(); } } }