void OnTakeDamage(DamageParams args) { if (args.damageType == DamageType.Hit) { SetState(State.Knockback); } }
private OperationResponse CallTestKill(MmoActor player, OperationRequest request, RPCInvokeOperation op) { bool success = false; var targetComponent = player.GetComponent <PlayerTarget>(); if (targetComponent.targetObject != null) { var targetDamagableComponent = targetComponent.targetObject.GetComponent <DamagableObject>(); if (targetDamagableComponent != null) { WeaponDamage weaponDamage = new WeaponDamage(WeaponBaseType.Rocket, 100000, 0, 0); DamageParams damageParams = new DamageParams(); damageParams.SetReflrected(false); damageParams.SetIgnoreFixedDamage(true); targetDamagableComponent.ReceiveDamage(new InputDamage(player.nebulaObject, weaponDamage, damageParams)); success = true; } } RPCInvokeResponse responseInstance = new RPCInvokeResponse { rpcId = op.rpcId, result = success }; return(new OperationResponse(request.OperationCode, responseInstance)); }
private void ResolveRapidAttackAnim(IAction p1a, IAction p2a, int momentIndex) { if (p1a.HasRapidAttack()) { P1MoveFailAnimation = true; P1MoveTo = Player1.Gradiator.RelativePosToAbsolute(Direction.Front.ToRelativePos()); DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = p1a.ResolveRapidAttack(momentIndex, Player1) }); if (p1a.ResolveRapidAttack(momentIndex, Player1) > 0) { Slashes.Add(Player2.Gradiator.Position); } } if (p2a.HasRapidAttack()) { P2MoveFailAnimation = true; P2MoveTo = Player2.Gradiator.RelativePosToAbsolute(Direction.Front.ToRelativePos()); DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = p2a.ResolveRapidAttack(momentIndex, Player2) }); if (p2a.ResolveRapidAttack(momentIndex, Player2) > 0) { Slashes.Add(Player1.Gradiator.Position); } } }
protected override void ExtraTakeDamage(DamageParams args) { base.ExtraTakeDamage(args); print("extra take damage"); if (args.damageType == DamageType.Hit) { SetState(State.Knockback); } }
public virtual void TakeDamage(DamageParams args) { print("i Was Hit amarifht"); Destroy(transform.GetComponent <PuzzleButton>()); transform.parent.GetComponent <PuzzelButtonHandler>().TriggerWasHit(); Destroy(transform.GetComponent <CapsuleCollider>()); transform.GetComponent <Rigidbody>().useGravity = true; }
public void ResetAnimation() { P1MoveAnimation = false; P2MoveAnimation = false; P1MoveFailAnimation = false; P2MoveFailAnimation = false; DamageParams.Clear(); Slashes.Clear(); Heal.Clear(); PowUp.Clear(); }
override public void TakeDamage(DamageParams args) { base.TakeDamage(args); }
virtual protected void ExtraTakeDamage(DamageParams args) { }
virtual public void TakeDamage(DamageParams args) { if (health > 0) { if (!squash.inSquash && iFramesTimer <= 0) { if (args.amount > 0) { SetHealth(health - args.amount); if (args.damageType == DamageType.Squash) { squash.DoSquash(health > 0); } else if (args.damageType == DamageType.Hit) { iFramesTimer = iFramesDuration; knockbackVector = knockbackMultiplier * args.knockback; StartCoroutine(Flasher()); } ExtraTakeDamage(args); } CameraEffects.Get.FreezeFrames(0.15f, 0.01f); switch (args.element) { case Element.None: break; case Element.Fire: if (flammable) { flammable.StartBurning(); if (!audioSource.isPlaying) { audioSource.PlayOneShot(burn, 0.5f); } } break; case Element.Ice: if (freezable) { freezable.FreezeStart(); if (!audioSource.isPlaying) { audioSource.PlayOneShot(slow, 1f); } } break; case Element.Poison: poisonStatus = poisonStatusDuration; if (poisonStatus > 0) { poisonEffectIndex = ParticleEffectsManager.GetEffect("Poison").Spawn(GetComponent <MeshRenderer>()); if (!audioSource.isPlaying) { audioSource.PlayOneShot(poisoned, 1f); } } break; case Element.Lightning: if (electracuted) { electracuted.ElcStart(); if (!audioSource.isPlaying) { audioSource.PlayOneShot(paralysis, 0.10f); } } break; } if (health <= 0) { Die(); if (Random.Range(1, 5) == 1) { Instantiate(powerUps[Random.Range(0, powerUps.Count - 1)], transform.position, Quaternion.identity); } } } } }
private void ResolveActionAttackAnim(IAction p1a, IAction p2a, int momentIndex) { if (p1a.HasActionAttack()) { P1MoveFailAnimation = true; P1MoveTo = Player1.Gradiator.RelativePosToAbsolute(Direction.Front.ToRelativePos()); if (p1a.ResolveDamage(momentIndex, Player1) == 0) { DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = 0 }); // miss } else { if (Player2.BigCounter) { Slashes.Add(Player1.Gradiator.Position); DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = p1a.ResolveDamage(momentIndex, Player1) * 2 }); } else { // damage Slashes.Add(Player2.Gradiator.Position); DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = p1a.ResolveDamage(momentIndex, Player1) }); } if (Player2.Cotton) { Heal.Add(Player2.Gradiator.Position); } if (Player2.Counter) { Slashes.Add(Player1.Gradiator.Position); DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = p1a.ResolveDamage(momentIndex, Player1) }); } } } if (p2a.HasActionAttack()) { P2MoveFailAnimation = true; P2MoveTo = Player2.Gradiator.RelativePosToAbsolute(Direction.Front.ToRelativePos()); if (p2a.ResolveDamage(momentIndex, Player2) == 0) { DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = 0 }); // miss } else { if (Player1.BigCounter) { Slashes.Add(Player2.Gradiator.Position); DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = p2a.ResolveDamage(momentIndex, Player2) * 2 }); } else { // damage Slashes.Add(Player1.Gradiator.Position); DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = p2a.ResolveDamage(momentIndex, Player2) }); } if (Player1.Cotton) { Heal.Add(Player1.Gradiator.Position); } if (Player1.Counter) { Slashes.Add(Player2.Gradiator.Position); DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = p2a.ResolveDamage(momentIndex, Player2) }); } } } }
private void ResolveMoveAnim(Pos p1to, Pos p2to) { bool p1Move = p1to != Player1.Gradiator.Position; bool p2Move = p2to != Player2.Gradiator.Position; if (p1Move && p2Move) { // 両方移動するとき // 移動先が同じまたはp1の移動先がp2の位置かつp2の移動先がp1の位置(交差)ならば衝突としてマーク bool isCollide = p1to == p2to || (p1to == Player2.Gradiator.Position && p2to == Player1.Gradiator.Position); if (!isCollide) { // p1が外に移動しようとするかつp2がp1の位置に移動しようとする→押し出し if (!p1to.IsInboundBoard() && p2to == Player1.Gradiator.Position) { // 衝突アニメーション P1MoveFailAnimation = true; P2MoveFailAnimation = true; P1MoveTo = p1to; P2MoveTo = p2to; DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = 1 }); } else if (!p2to.IsInboundBoard() && p1to == Player2.Gradiator.Position) { // 衝突アニメーション P1MoveFailAnimation = true; P2MoveFailAnimation = true; P1MoveTo = p1to; P2MoveTo = p2to; DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = 1 }); } else { // 衝突しないとき if (!p1to.IsInboundBoard()) { P1MoveFailAnimation = true; P1MoveTo = p1to; DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = 1 }); } else { P1MoveAnimation = true; P1MoveTo = p1to; } // 衝突しないとき if (!p2to.IsInboundBoard()) { P2MoveFailAnimation = true; P2MoveTo = p2to; DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = 1 }); } else { P2MoveAnimation = true; P2MoveTo = p2to; } } } else { // 衝突アニメーション P1MoveFailAnimation = true; P2MoveFailAnimation = true; P1MoveTo = p1to; P2MoveTo = p2to; } } else if (p1Move) { // p1のみ移動するとき if (p1to == p2to) // P2を押し込む場合 { RelativePos relative = new RelativePos(p1to.X - Player1.Gradiator.Position.X, p1to.Y - Player1.Gradiator.Position.Y); if (new Pos(Player2.Gradiator.Position.X + relative.X, Player2.Gradiator.Position.Y + relative.Y).IsInboundBoard()) // 押し込み可能 // アニメーション { P1MoveAnimation = true; P2MoveAnimation = true; P1MoveTo = p1to; P2MoveTo = new Pos(Player2.Gradiator.Position.X + relative.X, Player2.Gradiator.Position.Y + relative.Y); } else // 後が無い // アニメーション { P1MoveFailAnimation = true; P2MoveFailAnimation = true; P1MoveTo = p1to; P2MoveTo = new Pos(Player2.Gradiator.Position.X + relative.X, Player2.Gradiator.Position.Y + relative.Y); DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = 1 }); } } else // 通常移動 // アニメーション { if (p1to.IsInboundBoard()) { P1MoveAnimation = true; P1MoveTo = p1to; } else { P1MoveFailAnimation = true; P1MoveTo = p1to; DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = 1 }); } } } else if (p2Move) { // p2のみ移動するとき if (p1to == p2to) // P1を押し込む場合 { RelativePos relative = new RelativePos(p2to.X - Player2.Gradiator.Position.X, p2to.Y - Player2.Gradiator.Position.Y); if (new Pos(Player1.Gradiator.Position.X + relative.X, Player1.Gradiator.Position.Y + relative.Y).IsInboundBoard()) // 押し込み可能 // アニメーション { P1MoveAnimation = true; P2MoveAnimation = true; P2MoveTo = p2to; P1MoveTo = new Pos(Player1.Gradiator.Position.X + relative.X, Player1.Gradiator.Position.Y + relative.Y); } else // 後が無い // アニメーション { P1MoveFailAnimation = true; P2MoveFailAnimation = true; P2MoveTo = p2to; P1MoveTo = new Pos(Player1.Gradiator.Position.X + relative.X, Player1.Gradiator.Position.Y + relative.Y); DamageParams.Add(new DamageEffectParam { Pos = Player1.Gradiator.Position, Value = 1 }); } } else // 通常移動 // アニメーション { if (p2to.IsInboundBoard()) { P2MoveAnimation = true; P2MoveTo = p2to; } else { P2MoveFailAnimation = true; P2MoveTo = p2to; DamageParams.Add(new DamageEffectParam { Pos = Player2.Gradiator.Position, Value = 1 }); } } } }