////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void Awake() { EventManager.resetObjects += Reset; EventManager.CreateEventManagerIfNeeded(); _theRigidbody2D = GetComponent <Rigidbody2D> (); _theRigidbody2D.velocity = Vector2.zero; GMtoUnityConversion = FramesPerSecond / PixelsPerUnit; _jumpSpeed *= GMtoUnityConversion; _jumpSpeed2 *= GMtoUnityConversion; _moveSpeed *= GMtoUnityConversion; _gravity *= GMtoUnityConversion; _maxFallSpeed *= GMtoUnityConversion; B_maxFallSpeed = _maxFallSpeed; pixelMovement = false; disableCharacterMovement = false; disableCharacterJumping = false; disableCharacterShooting = false; anim = GetComponent <Animator>(); if (GetComponent <CalculateChecks> ()) { calculateChecks = GetComponent <CalculateChecks> (); } else { calculateChecks = gameObject.AddComponent <CalculateChecks> (); } calculateChecks.ChangeLayerMask(whatIsGround); }
void Start() { if (GetComponent <HPModule>()) { HPModule TEMP = GetComponent <HPModule>(); TEMP.On_HPModule_Death += MonsterDeath; } EventManager.resetObjects += Reset; startingPosition = gameObject.transform.position; if (JumpPower == 0) { JumpSpeed = 0; } anim = GetComponent <Animator>(); if (DefaultFacingRight) { Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; // BackupScale = theScale; Canvas[] childCanvases = GetComponentsInChildren <Canvas> (); foreach (Canvas child in childCanvases) { theScale = child.transform.localScale; theScale.x *= -1; child.transform.localScale = theScale; } } MonsterManipulation = gameObject.AddComponent <NewObjectSpawner> (); MonsterManipulation.SetProjectile(0, MonsterProjectile); MonsterManipulation.SetToEnablePooling(0, false); if (GetComponent <CalculateChecks> ()) { calculateChecks = GetComponent <CalculateChecks> (); } else { calculateChecks = gameObject.AddComponent <CalculateChecks> (); } calculateChecks.ChangeLayerMask(whatIsGround); calculateChecks.Set_ColliderIndent(ColliderIndent); StartCoroutine(C_StartAI()); }
void Start() { EventManager.resetObjects += Reset; startingPosition = gameObject.transform.position; anim = GetComponent <Animator>(); if (DefaultFacingRight) { Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; Canvas[] childCanvases = GetComponentsInChildren <Canvas> (); foreach (Canvas child in childCanvases) { theScale = child.transform.localScale; theScale.x *= -1; child.transform.localScale = theScale; } } MonsterManipulation = gameObject.AddComponent <NewObjectSpawner> (); MonsterManipulation.SetProjectile(0, MonsterProjectile); MonsterManipulation.SetToEnablePooling(0, false); // MonsterManipulation.AddSelfToList (0); // MonsterManipulation.ChangeColor_Children (0, 1f); // MonsterManipulation.SetColor_Random (0); // MonsterManipulation.SetKinematicObjects (0, false); // ScaleModifier = gameObject.transform.localScale.x; if (GetComponent <CalculateChecks> ()) { calculateChecks = GetComponent <CalculateChecks> (); } else { calculateChecks = gameObject.AddComponent <CalculateChecks> (); } calculateChecks.ChangeLayerMask(whatIsGround); StartCoroutine(C_StartAI()); }
public virtual void Start() { EventManager.resetObjects += Reset; HPModuleScript = GetComponent <HPModule> (); if (HPModuleScript != null) { HPModuleScript.On_HPModule_Death += OnMonsterDeath; } if (GetComponent <CalculateChecks> ()) { calculateChecks = GetComponent <CalculateChecks> (); } else { calculateChecks = gameObject.AddComponent <CalculateChecks> (); } calculateChecks.ChangeLayerMask(whatIsSolid); calculateChecks.Set_ColliderIndent(ColliderIndent); calculateChecks.Set_BackwardsSprite_X(DefaultFacingLeft); anim = GetComponent <Animator>(); startingPosition = gameObject.transform.position; if (DefaultFacingLeft) { facingRight = false; } else { facingRight = true; } List <MethodInfo> allTheFunctions = GetFunctionList(); PassiveAIAction = (CustomAIAction)Delegate.CreateDelegate(typeof(CustomAIAction), this, allTheFunctions[PassiveAINumber]); AlertAIAction = (CustomAIAction)Delegate.CreateDelegate(typeof(CustomAIAction), this, allTheFunctions[AlertAINumber]); AggressiveAIAction = (CustomAIAction)Delegate.CreateDelegate(typeof(CustomAIAction), this, allTheFunctions[AggressiveAINumber]); StartCoroutine(C_StartAI()); StartCoroutine(C_CalculateSurroundings()); }