private void InitializationDuJoueur() { Human = ScriptFactory.GetGameObjectHuman(); HumanPropertie = ScriptFactory.GetScriptAttachedOnGO <ScriptPnjProperties>(Human); HumanDeplacement = ScriptFactory.GetScriptAttachedOnGO <ScriptDeplacementSupervise>(Human); HumanDeplacement.CanMove = true; }
void Start() { // INITIALIZATIONS Debug.Log("Initialisation des relations..."); GOHumanObject = GameObject.Find("Human"); GOPanelMenuCentral = GameObject.Find("PanelMenuCentral"); GOPanelMenuDiplomacy = GameObject.Find("PanelMenuDiplomacy"); // MenuDiplomacy GOPanelMenuEconomy = GameObject.Find("PanelMenuEconomy"); GOPanelInformatif = GameObject.Find("PanelInformatif"); TRAllColliders = GameObject.Find("Colliders").transform; scriptPnjProperties = GOHumanObject.GetComponent <ScriptPnjProperties>(); ScriptStaticMethods.ClearLog(); }
// METHODES START private void InitializationDesBots() { Bots = ScriptFactory.GetGameObjectsBot(); BotsProperties = new ScriptPnjProperties[Bots.Length]; BotsDialogues = new ScriptParler[Bots.Length]; BotsTriggers = new ScriptTrigger[Bots.Length]; BotsDeplacements = new ScriptDeplacementAutomatique[Bots.Length]; foreach (GameObject bot in Bots) { Debug.Log("Chargement des bots..."); BotsProperties[i] = ScriptFactory.GetScriptAttachedOnGO <ScriptPnjProperties>(bot); BotsDeplacements[i] = ScriptFactory.GetScriptAttachedOnGO <ScriptDeplacementAutomatique>(bot); BotsTriggers[i] = ScriptFactory.GetScriptTriggerInChildOf(bot); BotsDialogues[i] = ScriptFactory.GetScriptParler(bot); BotsDialogues[i].IsTalking = false; i++; } }
// Use this for initialization void Start() { human = GameObject.Find("Human").GetComponent <ScriptPnjProperties>(); sante.text = "Santé: " + human.vie; endurance.text = "Endurance: " + human.endurance.ToString("F0"); }
public void Deplacer(ScriptShowDialogue panelConversation, ScriptPnjProperties pnjProperties) { // CONDITIONS (APPLICATION) if (CanMove && !panelConversation.isOpen) { WalkSpeedSelect = (Input.GetKey(inputWalkSpeed))? runSpeed:base.walkSpeed; if (Input.GetKey(inputFront) || Input.GetKey(inputLeft) || Input.GetKey(inputBack) || Input.GetKey(inputRight)) { base.Avancer(gameObject, WalkSpeedSelect); if (WalkSpeedSelect.Equals(runSpeed) && !(pnjProperties.endurance < 0)) { pnjProperties.DecrementerEndurance(1); } else { pnjProperties.IncrementerEndurance(0.5f); } } else { pnjProperties.IncrementerEndurance(1); } // Avancer vers l'avant if (Input.GetKey(inputFront)) { base.Rotationner(gameObject, 360); } // Avancer à droite (+ vers l'avant) if (Input.GetKey(inputRight)) { if (Input.GetKey(inputFront)) { base.Rotationner(gameObject, -45); } else { base.Rotationner(gameObject, -90); } } // Avancer à gauche if (Input.GetKey(inputLeft)) { if (Input.GetKey(inputFront)) { base.Rotationner(gameObject, 45); } else { base.Rotationner(gameObject, 90); } } // Avancer en bas (+ vers la gauche ou la droite) if (Input.GetKey(inputBack)) { if (Input.GetKey(inputRight)) { base.Rotationner(gameObject, -135); } else if (Input.GetKey(inputLeft)) { base.Rotationner(gameObject, 135); } else { base.Rotationner(gameObject, 180); } } } }