// Private Properties // #endregion #region Unity Methods void Awake() { player = GameObject.FindGameObjectWithTag("Player"); hpModule = gameObject.GetComponent <HPModule>(); attackingModule = gameObject.GetComponent <AttackingModule>(); awarnessModule = gameObject.GetComponent <AwarnessModule>(); }
public void ApplyEffect(HPModule target) { DamageOverTime myDamage = target.gameObject.AddComponent <DamageOverTime>(); myDamage.DamageSource = damageSource; myDamage.Damage = Damage; myDamage.Duration = Duration; myDamage.DamageInterval = DamageInterval; }
// Public Properties // // Private Properties // #endregion #region Unity Methods public void Start() { mainModule = gameObject.GetComponent <Enemy>(); Player = mainModule.Player.GetComponent <HPModule>(); playerLayer = LayerMask.GetMask("Player"); groundLayer = LayerMask.GetMask("Ground"); InvokeRepeating("AttackPlayer", 0, 1f); }
// Public Properties // // Private Properties // #endregion #region Unity Methods void Start() { //MAKING SURE THAT TARGET IS ONLY "ON ONE FIRE" - NO STACKING ALLOWED DamageOverTime other; if ((other = gameObject.GetComponent <DamageOverTime>()) && other != this) { Destroy(other); } target = gameObject.GetComponent <HPModule>(); Destroy(this, Duration); InvokeRepeating("DamageTarget", 0f, DamageInterval); }
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()); }
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()); }
// Public Properties // // Private Properties // #endregion #region Unity Methods void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <HPModule>(); Destroy(gameObject, 3f); }