private void InitializeShadow() { /*Find the shadow and the character movement script component*/ shadow = transform.Find("Shadow").gameObject; shadowMoveScript = shadow.GetComponent <CharacterMovements>(); GameDebug.AssertInTransform(shadow != null && shadowMoveScript != null, transform, "There must be a gameObject named \"shadow\" with a CharacterMovements"); /*Initialize shadow movement script*/ shadowMoveScript.properties = shadowProperties.movementProperties; shadowMoveScript.audio = shadowProperties.audioComponent; /*Find the animator component*/ shadowAnimator = shadow.transform.Find("body").GetComponent <Animator>(); shadowMoveScript.animator = shadowAnimator; GameDebug.AssertInTransform(shadowAnimator != null, shadow.transform, "There must be a gameObject named \"body\" with a Animator"); if (shadowProperties.movementProperties.avoidSlowMotion) { float multiplicator = 1f / GameObject.Find("Manager/TimeManager").GetComponent <TimeManager>().getTimeScaleInFirstPlanWhenSwitch(); shadowProperties.movementProperties.scaleMotion(multiplicator); } if (shadowProperties.activateShadowOnStart) { EnableShadow(); } else { DisableShadow(); } }
// Start is called before the first frame update void Start() { GameDebug.AssertInTransform(inputManager != null, transform, "input manager should not be null"); currentInputOptionsID = PlayerPrefs.GetInt("inputs"); LoadPreset(); }
private void Start() { GameDebug.AssertInTransform(subMenus != null, transform, "subMenus should not be null"); GameDebug.AssertInTransform(subMenus.Length != 0, transform, "subMenus should have at least one element"); GameDebug.AssertInTransform(subMenus[0] != null, transform, "First element of subMenus should not be null"); GameDebug.AssertInTransform(controller != null, transform, "controller should not be null"); GameDebug.AssertInTransform(inputManager != null, transform, "inputManager shoud not be null"); }
private void Awake() { laserRay = transform.Find("LaserRay").gameObject; GameDebug.AssertInTransform(laserRay != null, transform, "There must be a gameObject named \"LaserRay\" with a CharacterMovements"); laserRay.transform.localScale = new Vector3(laserRadius, 1f, laserRadius); laserRay.SetActive(isActivate); if (humming) { hummingAudio = GetComponent <AudioSource>(); if (!hummingAudio) { hummingAudio = gameObject.AddComponent <AudioSource>(); } hummingAudio.clip = humming; hummingAudio.loop = true; if (isActivate) { hummingAudio.Play(); } } pc = GameObject.FindObjectOfType <PlayerController>(); if (!pc) { Debug.Log("Not found"); } else { pc.onTransposed += ToggleHumming; pc.onUntransposed += ToggleHumming; } }
private void InitializeBody() { /*Find the body and the character movement script component*/ body = transform.Find("Body").gameObject; bodyMoveScript = body.GetComponent <CharacterMovements>(); GameDebug.AssertInTransform(body != null && bodyMoveScript != null, transform, "There must be a gameObject named \"Body\" with a CharacterMovements"); /*Initialize body movement script*/ bodyMoveScript.properties = bodyProperties.movementProperties; bodyMoveScript.audio = bodyProperties.audioComponent; /*Find the animator component*/ bodyAnimator = body.transform.Find("body").GetComponent <Animator>(); bodyMoveScript.animator = bodyAnimator; bodyMoveScript.secondAnimator = shadowAnimator; GameDebug.AssertInTransform(bodyAnimator != null, body.transform, "There must be a gameObject named \"body\" with a Animator"); if (bodyProperties.movementProperties.avoidSlowMotion) { float multiplicator = 1f / GameObject.Find("Manager/TimeManager").GetComponent <TimeManager>().getTimeScaleInFirstPlanWhenSwitch(); bodyProperties.movementProperties.scaleMotion(multiplicator); } }
private void Awake() { GameDebug.AssertInTransform(pc != null, transform, "pc should not be null"); }