private void Initialise() { CreaturePrefabManager prefabManager = GameObject.FindGameObjectWithTag("CreaturePrefabManager").GetComponent <CreaturePrefabManager>(); foreach (CreaturePrefabManager.PrefabData prefabData in prefabManager.lMonsters) { ModelMonsterUI mm = prefabData.prefab.GetComponent <ModelMonsterUI>(); allMutations.Add(new MutationData(prefabData.id, CaractMonster.NONE, mm.permanentMutation)); } }
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); }
public float GetBonus(ActionType actionType, Human human, GroupMonsterFighter groupMonster) { float bonus = 0; List <Tip> myTips = GetTipsOfAction(actionType, human.eCreatureType); CaractHumainCheveux chm = human.currentUI.gameObject.GetComponentInChildren <ModelHumainUI>().caractCheveux; myTips = GetTipsAboutHumainCarac(chm, myTips); foreach (Fighter fighter in groupMonster.lFighters) { if (fighter.CanAttack()) { ModelMonsterUI modelM = ((Monster)fighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); if (modelM != null) { CaractMonster tempCarac = modelM.caractMonster; CaractMonster permaCarac = modelM.permanentCarMutation; foreach (Tip tip in myTips) { if (tip.caracMonster == tempCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } else if (tip.caracMonster == permaCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } if (bonus != 0) { break; } } } } if (bonus != 0) { break; } } myTips = GetTipsOfAction(actionType, human.eCreatureType); CaractHumainStuff chs = human.currentUI.gameObject.GetComponentInChildren <ModelHumainUI>().caractStuff; myTips = GetTipsAboutHumainCarac(chs, myTips); foreach (Fighter fighter in groupMonster.lFighters) { if (fighter.CanAttack()) { ModelMonsterUI modelM = ((Monster)fighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); if (modelM != null) { CaractMonster tempCarac = modelM.caractMonster; CaractMonster permaCarac = modelM.permanentCarMutation; foreach (Tip tip in myTips) { if (tip.caracMonster == tempCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } else if (tip.caracMonster == permaCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } if (bonus != 0) { break; } } } } if (bonus != 0) { break; } } // CaractMonster mutation; return(bonus); }
// 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); } } }