public void Init() { foreach (Transform child in Tete.transform) { if (child.gameObject.activeSelf) { HumainHeadUI headUI = child.gameObject.GetComponent <HumainHeadUI>(); if (headUI != null) { caractCheveux = CaractHumainCheveux.GetCaractHumainOfEnum(headUI._enumcheveux); } } } }
public void SetCaract(CaractHumainCheveux caract) { caractCheveux = caract; foreach (Transform child in Tete.transform) { HumainHeadUI headUI = child.gameObject.GetComponent <HumainHeadUI>(); if (headUI != null) { if (headUI._enumcheveux == caract.enumCaract) { child.gameObject.SetActive(true); } else { child.gameObject.SetActive(false); } } } }
void Initialise() { CaractHumainStuff test = CaractHumainStuff.ARC; CaractHumainCheveux test2 = CaractHumainCheveux.BLANC; List <CaractMonster> allCaracMonster = new List <CaractMonster>(); List <CaractHumain> allCaracHumain = new List <CaractHumain>(); CaractMonster[] allCaracMonsterA = new CaractMonster[CaractMonster.GetAllCarac().Count]; CaractHumain[] allCaracHumainA = new CaractHumain[CaractHumain.GetAllCarac().Count]; CaractMonster.GetAllCarac().CopyTo(allCaracMonsterA); CaractHumain.GetAllCarac().CopyTo(allCaracHumainA); allCaracMonster = allCaracMonsterA.ToList(); allCaracHumain = allCaracHumainA.ToList(); //System.Array.Copy( , allCaracMonster, CaractMonster.GetAllCarac().Count); Tip tip; for (int i = 0; i < allCaracMonster.Count && allCaracHumain.Count > 0;) { tip = new Tip(); int randIndexMonster = Random.Range(0, allCaracMonster.Count); int randIndexHumain = Random.Range(0, allCaracHumain.Count); tip.caracMonster = allCaracMonster[randIndexMonster]; tip.caracHumain = allCaracHumain[randIndexHumain]; allCaracMonster.RemoveAt(randIndexMonster); allCaracHumain.RemoveAt(randIndexHumain); listTips.Add(tip); ModRoll roll = ModRoll.GetRandomMod(); tip.modroll = roll; } CaractMonster.GetAllCarac().CopyTo(allCaracMonsterA); allCaracMonster = allCaracMonsterA.ToList(); for (int i = 0; i < allCaracMonster.Count && allCaracHumain.Count > 0;) { tip = new Tip(); int randIndexMonster = Random.Range(0, allCaracMonster.Count); int randIndexHumain = Random.Range(0, allCaracHumain.Count); tip.caracMonster = allCaracMonster[randIndexMonster]; tip.caracHumain = allCaracHumain[randIndexHumain]; allCaracMonster.RemoveAt(randIndexMonster); allCaracHumain.RemoveAt(randIndexHumain); ModRoll roll = ModRoll.GetRandomMod(); tip.modroll = roll; listTips.Add(tip); } foreach (Tip t in listTips) { Tip newTip = new Tip(); newTip.CopyTips(t); tipsNotKnownByPlayer.Add(newTip); } }
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); }
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); }
public void RandomCheveux() { SetCaract(CaractHumainCheveux.GetRandomCarac()); }