public override bool ApplyEffect(AActor2D actor) { base.ApplyEffect(actor); MovementControls actorMvmnt = actor.MvmntCmp; if (actorMvmnt == null) return false; actorMvmnt.SetMaxSpeed(actorMvmnt.MaxRunSpeed * StaggerSpeed); return true; }//ApplyEffect
}//Start public virtual void RegisterActor(AActor2D actor) { #if UNITY_EDITOR if (ActorParent != null) { string msg = "Overwriting ActorCmp from RegisterActor while ActorParent is set from Editor in '{0}'!"; Debug.LogWarning(string.Format(msg, this.name)); } #endif _actor = actor; }//RegisterActor
}//ApplyEffect public override bool RemoveEffect(AActor2D actor) { base.RemoveEffect(actor); MovementControls actorMvmnt = actor.MvmntCmp; if (actorMvmnt == null) return false; actorMvmnt.ResetMaxSpeed(); return true; }//RemoveEffect
}//UnsetImposter public void KillTargetOnDeath(GameObject go) { //This actor is Not an imposter. Prbbly a Player. if (this.Target == null) { return; } //Imposter reveild. Cant damage Player anymore. if (this.origSprite == SpriteCmp.sprite) { return; } AActor2D targetActor = Impostered.ThisActor; targetActor.DamagableCmp.TakeDamage(this.gameObject, int.MaxValue, false); }//KillTargetOnDeath
}//OnEnemyDied private void subscribeToDeathEvent(bool state) { for (int i = 0; i < this.enemies.Count; i++) { AActor2D enemy = this.enemies[i]; if (enemy.DamagableCmp == null) { return; } enemy.DamagableCmp.EOnDeath -= OnEnemyDied; if (state) { enemy.DamagableCmp.EOnDeath += OnEnemyDied; } }//for hasInit = true; }//subscribeToDeathEvent
public void Start() { //Not set manually? Therefore either in parent or in self. if (ControlledBy == null) { ControlledBy = GetComponentInParent <AActor2D>(); if (ControlledBy == null) { ControlledBy = GetComponent <AActor2D>(); } } ColliderCmp = GetComponentInChildren <Collider2D>(); LadderClimberCmp = GetComponentInParent <LadderClimber>(); DamagableCmp = ControlledBy.DamagableCmp; DamagableCmp.EOnDamageTaken += OnDamageTaken; DamagableCmp.EOnCritHit += OnDamageTaken; StateMachineAnimator.Rebind(); }//Start
public void Start() { if(Owner == null) Owner = GetComponentInParent<AActor2D>(); }//Start
/* ---------------------- ---------------------- ---------------------- */ public void Start() { if (this.Actor == null) this.Actor = GetComponent<AActor2D>(); _input = this.Actor.GetComponent<InputManager>(); }//Start
}//ApplyEffect public virtual bool RemoveEffect(AActor2D actor) { this.timeOfApply = -1f; return true; }//RemoveEffect
public virtual bool ApplyEffect(AActor2D actor) { this.timeOfApply = Time.timeSinceLevelLoad; return true; }//ApplyEffect
}//RegisterActor /// <summary> /// Something that is called on Start to initiate components states and such. /// </summary> protected virtual void init() { if (ActorCmp == null) _actor = GetComponentInParent<AActor2D>(); if (ActorCmp == null) _actor = GetComponent<AActor2D>(); }//init
public void Start() { _actor = GetComponent <AActor2D>(); }