//*******************************// // MonoBehaviour Functions // //*******************************// void Start() { m_actor = GetComponent <Actor2D>(); m_enemy = GetComponent <Enemy>(); m_rb = GetComponent <Rigidbody2D>(); //m_droppedShieldPosition = m_shield.transform.position; }
//*******************************// // MonoBehaviour Functions // //*******************************// // Start is called before the first frame update void Start() { m_actor = GetComponent <Actor2D>(); m_enemy = GetComponent <Enemy>(); m_rb = GetComponent <Rigidbody2D>(); GetComponent <Animator>().SetFloat("RangedAttackSpeed", m_rangedAnimBaseSpeed); }
public void ReceiveDamage(Damager other) { _alreadyHitThisUpdate.Add(other.gameObject); if (this.ApplyDamageLocally) this.Health -= other.Damage; if (!this.IgnoreHealthCallbacks) { foreach (HealthCallback callback in this.OnHealthChangeCallbacks) callback(this, this.Health >= 0 ? other.Damage : other.Damage + this.Health); } Vector2 impactVector = Vector2.zero; if (!this.Stationary) { Vector2 difference = this.integerPosition - other.integerPosition; Actor2D otherActor = other.gameObject.GetComponent<Actor2D>(); Vector2 otherV = otherActor != null ? otherActor.Velocity : Vector2.zero; difference.Normalize(); otherV.Normalize(); impactVector = (difference + otherV).normalized; } if (this.Health <= 0) { _deathKnockback = other.Knockback * this.KnockbackMultiplier; _deathImpactVector = impactVector; markForDeath(); } else { if (!this.Stationary) { _actor.SetVelocityModifier(VELOCITY_MODIFIER_KEY, new VelocityModifier(impactVector * other.Knockback * this.KnockbackMultiplier, VelocityModifier.CollisionBehavior.bounce)); _nonInvincibleCollisionMask = _actor.CollisionMask; _actor.CollisionMask = this.InvincibilityCollisionMask; } this.Invincible = true; _invincibilityTimer = other.HitInvincibilityDuration * this.HitInvincibilityMultiplier; this.integerCollider.RemoveFromCollisionPool(); this.localNotifier.SendEvent(new InvincibilityToggleEvent(true)); if (_audio != null && this.AudioOnHit != null) { _audio.clip = this.AudioOnHit; _audio.Play(); } } if (this.BaseShakeHitMagnitude > 0.0f || this.ShakeHitToDamageRatio > 0.0f) { Camera.main.GetComponent<ShakeHandler>().ApplyImpact(this.BaseShakeHitMagnitude + this.ShakeHitToDamageRatio * other.Damage); } }
private bool OnCollectibleCollision(CollisionSkin skin0, CollisionSkin skin1) { if (skin1.Owner.ExternalData is Tile collide) { switch (collide.TileType) { case ETileType.Player: Tile collectible = skin0.Owner.ExternalData as Tile; Actor2D mug = main.UiManager.UIObjectList.Find(actor2D => collectible != null && actor2D.ID.Equals(collectible.ID)); if (mug != null) { mug.StatusType = StatusType.Drawn; } //Trigger Collectible animation if (collectible != null) { EventManager.FireEvent(new RemoveActorEvent { body = collectible.Body }); collectible.MoveTo(new AnimationEventData { isRelative = false, destination = collectible.Transform3D.Translation + Vector3.Up, maxTime = 500, smoothing = Smoother.SmoothingMethod.Smooth, loopMethod = LoopMethod.PlayOnce }); collectible.ScaleTo(new AnimationEventData { isRelative = false, destination = Vector3.One * 1.5f, maxTime = 1000, smoothing = Smoother.SmoothingMethod.Smooth, loopMethod = LoopMethod.PingPongOnce, callback = () => EventManager.FireEvent(new RemoveActorEvent { actor3D = collectible }) }); collectible.RotateTo(new AnimationEventData { isRelative = true, destination = Vector3.Up * 720, maxTime = 1000, smoothing = Smoother.SmoothingMethod.Smooth }); EventManager.FireEvent(new SoundEventInfo { soundEventType = SoundEventType.PlaySfx, sfxType = SfxType.CollectibleCollected, soundLocation = collectible.Transform3D.Translation }); } break; } } return(true); }
//*******************************// // MonoBehaviour Functions // //*******************************// private void Awake() { m_input = GetComponent <PlayerInput>(); m_actor = GetComponent <Actor2D>(); m_rb = GetComponent <Rigidbody2D>(); m_inputState = new InputState(); }
//*******************************// // MonoBehaviour Functions // //*******************************// private void Start() { m_actor = GetComponent <Actor2D>(); m_rb = GetComponent <Rigidbody2D>(); m_anim = GetComponent <Animator>(); m_pc = GetComponent <PlayerCombat>(); m_pm = GetComponent <PlayerMovement>(); }
//*******************************// // MonoBehaviour Functions // //*******************************// //public GameObject DotPrefab; //GameObject DotParent; //only for visuals //was passiert wenn du den gegner in der luft triffst? //jump values noch anpassen void Start() { m_actor = GetComponent <Actor2D>(); m_rb = GetComponent <Rigidbody2D>(); m_coll = GetComponent <Collider2D>(); m_enemy = GetComponent <Enemy>(); //DotParent = new GameObject("Parent Dot Enemy"); //only for visuals }
//*******************************// // MonoBehaviour Functions // //*******************************// void Start() { m_actor = GetComponent <Actor2D>(); m_coll = GetComponent <Collider2D>(); m_rb = GetComponent <Rigidbody2D>(); m_ekb = GetComponentInChildren <EnemyKnockback>(); m_spriteRenderer = GetComponent <SpriteRenderer>(); m_currentHealth = m_maxHealth; }
//private EnemyKnockback m_ekb; //*******************************// // MonoBehaviour Functions // //*******************************// // Start is called before the first frame update void Start() { m_currentStunTime = m_stunTime; m_flightHeight = transform.position.y; SetFlightHeight(); m_actor = GetComponent <Actor2D>(); m_enemy = GetComponent <Enemy>(); m_rb = GetComponent <Rigidbody2D>(); //m_ekb = GetComponentInChildren<EnemyKnockback>(); }
//*******************************// // MonoBehaviour Functions // //*******************************// //private void Awake() //{ // //? //} //cooldown on melee attack? --> allgemein nach jedem angriff kurz 0.4f sec oder so wartezeit? private void Start() { m_originalColor = GetComponent <SpriteRenderer>().color; m_enemiesHit = new List <Collider2D>(); m_xAxis = Input.GetAxis("Horizontal"); m_input = GetComponent <PlayerInput>(); m_actor = GetComponent <Actor2D>(); m_pm = GetComponent <PlayerMovement>(); m_sr = GetComponent <SpriteRenderer>(); m_pa = GetComponent <PlayerAnim>(); //UpdateHealthVisual(); }
private void ExitSpreadOut() { _stateSwitch = false; foreach (GameObject subBoss in this.SubBosses) { //Vector2 velocity = this.StartingVelocities[Random.Range(0, this.StartingVelocities.Length)]; Actor2D actor = subBoss.GetComponent <Actor2D>(); actor.Velocity = Vector2.zero; actor.HaltMovementMask &= ~this.LevelGeomLayerMask; actor.CollisionMask &= ~this.LevelGeomLayerMask; actor.RemoveVelocityModifier(VELOCITY_KEY); } }
private void EnterSpreadOut() { foreach (GameObject subBoss in this.SubBosses) { Vector2 velocity = this.StartingVelocities[Random.Range(0, this.StartingVelocities.Length)]; Actor2D actor = subBoss.GetComponent <Actor2D>(); actor.HaltMovementMask |= this.LevelGeomLayerMask; actor.CollisionMask |= this.LevelGeomLayerMask; actor.SetVelocityModifier(VELOCITY_KEY, new VelocityModifier(Random.Range(this.SubBossMinSpeed, this.SubBossMaxSpeed) * velocity.normalized, VelocityModifier.CollisionBehavior.bounce)); subBoss.GetComponent <Rotation>().IsRotating = true; } _timedCallbacks.AddCallback(this, this.TimeForStateSwitch, this.TimeSpreadOut); }
//*******************************// // MonoBehaviour Functions // //*******************************// void Start() { m_controllerDeadzone = 0.5f; m_normalTimeScale = Time.timeScale; m_totalHookPoints = new List <Collider2D>(); m_controllerDirection = Vector2.zero; m_input = GetComponent <PlayerInput>(); m_actor = GetComponent <Actor2D>(); m_pm = GetComponent <PlayerMovement>(); m_rb = GetComponent <Rigidbody2D>(); m_pa = GetComponent <PlayerAnim>(); m_pt = GetComponent <PlayerThrow>(); if (m_hookPointVisualization != null) { m_hookPointVisualization.GetComponent <HookPointVisualization>().SetObjectScale(m_hookRadius); } }
// Start is called before the first frame update void Start() { player = GetComponent <Actor2D>(); }
//*******************************// // MonoBehaviour Functions // //*******************************// //void Start() //{ // m_actor = GetComponent<Actor2D>(); // m_rb = GetComponent<Rigidbody2D>(); // m_okb = GetComponentInChildren<ObjectKnockBack>(); //} private void Awake() //could be better for instantiate { m_actor = GetComponent <Actor2D>(); m_rb = GetComponent <Rigidbody2D>(); m_okb = GetComponentInChildren <ObjectKnockBack>(); }
//*******************************// // MonoBehaviour Functions // //*******************************// private void Awake() { actor = GetComponent <Actor2D>(); }
private void DamageCharacter() { Actor2D actor = target as Actor2D; actor.ApplyDamage(2f); }
private void KillCharacter() { Actor2D actor = target as Actor2D; actor.Kill(); }
void Start() { _actor = this.GetComponent<Actor2D>(); _audio = this.GetComponent<AudioSource>(); this.localNotifier.Listen(HitEvent.NAME, this, this.OnHit); }
void Start() { actor = GetComponent <Actor2D>(); }
// Start is called before the first frame update void Start() { m_actor = GetComponent <Actor2D>(); m_respawnPoint = transform.position; m_timer = m_saveInterval; }