public BuffComponent(LogicEntity entity) : base(entity) { }
public LogicAnim(LogicEntity entity) : base(entity) { }
public void Hit(int eID, int otherID, FixedVector2 hitPoint) { LogicEntity e = Contexts.sharedInstance.logic.GetEntityWithId(eID); LogicEntity other = Contexts.sharedInstance.logic.GetEntityWithId(otherID); if (other == null) { return; } if (other.hasFollowPoint && other.isAttached) { other = Contexts.sharedInstance.logic.GetEntityWithId(other.followPoint.targetID); } if (!other.isHitable) { return; } // FixedVector2 offset = new FixedVector2 ( // (e.collider.value.halfExtents.x / 2) * e.velocity.value.x.Sign (), // //- (e.collider.value.halfExtents.y / 2) // 0 // ); FixedVector2 offset = new FixedVector2( //(e.collider.value.halfExtents.x / 2) * e.velocity.value.x.Sign (), //- (e.collider.value.halfExtents.y / 2) 0, -FixedMath.Create(1, 10) ); long knockback = e.knockBack.value.Mul(e.weight.value); FixedVector2 direction = (hitPoint - (e.position.value + offset)).normalized; if (other.hasHat) { other.ReplaceVelocity(direction * knockback); e.ReplaceFreeze(5); other.ReplaceFreeze(5); LogicEntity otherHat = Contexts.sharedInstance.logic.GetEntityWithId(other.hat.entityID); if (otherHat.isAttached) { otherHat.ReplaceVelocity((other.velocity.value.FlipX().FlipY())); otherHat.ReplaceFreeze(5); otherHat.throwMovement.throwPositionY = other.position.value.y; otherHat.isAttached = false; otherHat.isFalling = true; } other.isStunned = true; other.ReplaceStunTimer(e.stunTime.value); other.ReplaceCurrentMovementX( other.velocity.value.x, other.stunMovement.accelerationTime, 0); } else if (other.isDangerous) { e.ReplaceFreeze(5); other.ReplaceFreeze(5); } else { direction = e.position.value - other.position.value; other.ReplaceVelocity(direction * knockback / 2); } if (e.hasThrowTimer) { e.RemoveThrowTimer(); } }
private void DangerOverFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(HatSounds.EXTINGUISH_SOUND, go); }
private void ThrowFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(name + HatSounds.THROW_SOUND, go); }
private void HitPlayerFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(HatSounds.PLAYER_HIT_SOUND, go); Debug.Log("Hit"); }
private void EmptyFunction(LogicEntity obj) { }
public virtual void OnDangerous(LogicEntity entity) { prefabManager.ManageGameObject("Fire", true); prefabManager.ManageGameObject("Trail", true); }
public virtual void OnDangerousRemoved(LogicEntity entity) { prefabManager.ManageGameObject("Fire", false); prefabManager.ManageGameObject("Trail", false); }
private void CreatePlayer(int id, CharacterBlueprint c) { LogicEntity e = Contexts.sharedInstance.logic.CreateEntity(); //Add the logic e.AddPlayerID(id); e.AddPosition( new FixedVector2(0, 0) ); e.AddRotation(0); e.AddScale( new FixedVector2( CharacterBlueprint.scale, CharacterBlueprint.scale) ); e.AddVelocity( new FixedVector2(0, 0) ); e.AddAcceleration( new FixedVector2(0, 0) ); e.isMovable = true; e.AddLastPosition(e.position.value); e.AddLastVelocity(e.velocity.value); //Movement e.AddCurrentMovementX(0, 0, 0); e.AddGroundMovement(c.groundSpeed, c.groundAcceleration); e.AddAirMovement(c.airSpeed, c.airAcceleration); e.AddDashMovement(c.dashSpeed, c.dashAcceleration, c.dashLength); e.AddStunMovement(0, FixedMath.Create(2)); e.AddWallRideMovement( c.maxSlideSpeed, c.fastSlideFactor, c.innerJump, c.neutralJump, c.outerJump, //acceleration FixedMath.Create(2, 10), //walljump length FixedMath.Create(25, 100), //stick time FixedMath.Create(5, 100) ); e.AddDirection(1); //Jump e.AddTimeToApex(c.timeToJumpApex); e.AddMinJump(c.minJump); // 1.5 e.AddMaxJump(c.maxJump); e.AddJumpsAllowed(c.jumpsAllowed); e.AddJumpsCompleted(0); e.AddFastFallFactor(c.fastFallFactor); e.AddTerminalVelocity(c.terminalVelocity); e.AddFastFallTerminalVelocity(c.terminalVelocityFastFall); e.AddBounceHeight(c.bounceHeight); e.AddStunTime(FixedMath.Hundredth * 2); e.AddReflectionDampening(c.reflectionDampPlayer.x, c.reflectionDampPlayer.y); e.AddCollider(new Determinism.BoxCollider(e.position.value, c.playerColOffsetPosition * CharacterBlueprint.scale, c.playerColScale * CharacterBlueprint.scale)); e.AddOnRayCastCollision(new CommandInput.PlayerRayCastCollisionCommand(e.id.value)); e.AddOnTriggerEnter(new OnTriggerEnterCommand(e.id.value)); e.collider.value.tag = Tag.PLAYER; e.collider.value.mask = (Mask)(1 << (id + 1)); e.collider.value.check = e.collider.value.check.AddFlags(Mask.DEFAULT, Mask.P1, Mask.P2, Mask.P3, Mask.P4, Mask.P5, Mask.P6, Mask.P7, Mask.P8); e.collider.value.check = e.collider.value.check.RemoveFlag(e.collider.value.mask); e.AddPusher(new List <Passenger> ()); e.isHitable = true; e.AddWeight(c.weightFactor); e.AddHat(CreateHat(id, e.id.value, c)); e.isRespawn = true; var view = Object.Instantiate(c.player).GetComponent <IView>(); view.Link(e, Contexts.sharedInstance.logic); }
public virtual void OnDirty(LogicEntity entity) { }
private int CreateHat(int id, int ownerID, CharacterBlueprint c) { LogicEntity e = Contexts.sharedInstance.logic.CreateEntity(); e.AddPosition( new FixedVector2(0, 0) ); e.AddRotation(0); e.AddLastRotation(0); e.AddScale(new FixedVector2( CharacterBlueprint.scale, CharacterBlueprint.scale) ); e.AddVelocity( new FixedVector2(0, 0) ); e.AddAcceleration( new FixedVector2(0, 0) ); e.isMovable = true; e.AddLastPosition(e.position.value); e.AddLastVelocity(e.velocity.value); //Movement e.AddDirection(1); //Follow e.isAttached = true; e.AddFollowPoint(ownerID, c.followSpeed, c.followPoint, c.pickUpRadius, c.maxRotation); //gravity is 50 * greater than in game e.AddGravity(c.gravity * 50); e.AddFriction(c.normalFriction, c.dangerousFriction); e.AddDrag(c.normalDrag, c.dangerousDrag); //* 50 / 10 from original amt e.AddThrowMovement(c.throwPower * 5, 0); //Throw e.AddKnockBack(c.blowBack); e.AddStunTime(c.stunTime); e.AddReflectionDampening(c.reflectionDampHat.x, c.reflectionDampHat.y); //collision e.AddCollider(new Determinism.BoxCollider(e.position.value, c.hatColOffsetPosition * CharacterBlueprint.scale, c.hatColScale * CharacterBlueprint.scale)); e.AddOnRayCastCollision(new CommandInput.HatRayCastCollisionCommand(e.id.value)); e.collider.value.tag = Tag.HAT; e.collider.value.mask = (Mask)(1 << (id + 1)); e.collider.value.isTrigger = true; e.collider.value.check = e.collider.value.check.AddFlags(Mask.DEFAULT, Mask.P1, Mask.P2, Mask.P3, Mask.P4, Mask.P5, Mask.P6, Mask.P7, Mask.P8); e.collider.value.check = e.collider.value.check.RemoveFlag(e.collider.value.mask); e.isHitable = true; e.isPusheable = true; e.AddWeight(c.weightFactor); var view = Object.Instantiate(c.hat).GetComponent <IView>(); view.Link(e, Contexts.sharedInstance.logic); return(e.id.value); }
public EffectReceiver(LogicEntity entity) : base(entity) { }
public override void OnCollisionEnter(RaycastCollisionInfo info) { LogicEntity e = Contexts.sharedInstance.logic.GetEntityWithId(entityID); if (e.isStunned) { if (!info.CollidesWithHorizontal(Tag.HAT) && info.CollidesHorizontal()) { e.ReplaceVelocity(new FixedVector2( -e.velocity.value.x.Mul(e.reflectionDampening.xDampening), e.velocity.value.y + (e.velocity.value.y.Sign() * e.velocity.value.x.Abs()).Mul(e.reflectionDampening.yDampening)) ); } if (!info.CollidesWithVertical(Tag.HAT) && info.up != Tag.NONE) { e.ReplaceVelocity(e.velocity.value.SetY(0)); } return; } LogicEntity leftEntity = Contexts.sharedInstance.logic.GetEntityWithId(info.leftID); LogicEntity rightEntity = Contexts.sharedInstance.logic.GetEntityWithId(info.rightID); LogicEntity upEntity = Contexts.sharedInstance.logic.GetEntityWithId(info.upID); LogicEntity downEntity = Contexts.sharedInstance.logic.GetEntityWithId(info.downID); if (!info.CollidesWithVertical(Tag.HAT) && info.CollidesVertical()) { e.ReplaceVelocity(e.velocity.value.SetY(0)); } if ((info.left != Tag.NONE || info.right != Tag.NONE)) { if (info.horizontalHit.y > e.position.value.y) { e.isWallRiding = true; e.isDashing = false; } } if ((info.down == Tag.HAT && info.downID != e.hat.entityID) && !downEntity.isDangerous && !downEntity.isInvincible) { LogicEntity hat = Contexts.sharedInstance.logic.GetEntityWithId(info.downID); hat.isDead = true; hat.ReplaceDeathTimer(DEATH_TIME); LogicEntity player = Contexts.sharedInstance.logic.GetEntityWithId(hat.followPoint.targetID); player.isDead = true; player.ReplaceFreeze(DEATH_FREEZE_FRAMES); player.ReplaceDeathTimer(DEATH_TIME); } if (info.down == Tag.DEFAULT) { e.ReplaceJumpsCompleted(0); e.isGrounded = true; e.isWallRiding = false; } else if ((info.down == Tag.HAT || info.down == Tag.PLAYER) && !downEntity.isDangerous) { //Bounce if (info.down == Tag.PLAYER && !e.isStunned) { downEntity.isStunned = true; downEntity.ReplaceStunTimer(e.stunTime.value); downEntity.ReplaceCurrentMovementX(0, 0, 0); downEntity.ReplaceVelocity(downEntity.velocity.value.SetX(0)); } e.ReplaceVelocity(e.velocity.value.SetY(e.bounceVelocity.value)); e.jumpsCompleted.value = 0; e.isGrounded = false; e.isDashing = false; } else { e.isGrounded = false; e.isDashing = false; } if (e.hasPusher) { if (info.left != Tag.NONE && leftEntity.isPusheable && !leftEntity.isStunned && !leftEntity.isDangerous) { e.pusher.passengers.Add(new Passenger(info.leftID, true, false)); } if (info.right != Tag.NONE && rightEntity.isPusheable && !rightEntity.isStunned && !rightEntity.isDangerous) { e.pusher.passengers.Add(new Passenger(info.rightID, true, false)); } if (info.up != Tag.NONE && upEntity.isPusheable && !upEntity.isStunned && !upEntity.isDangerous) { e.pusher.passengers.Add(new Passenger(info.upID, false, true)); } if (info.down != Tag.NONE && downEntity.isPusheable && !downEntity.isStunned && !downEntity.isDangerous) { e.pusher.passengers.Add(new Passenger(info.downID, false, true)); } e.ReplacePusher(e.pusher.passengers); } }
private void StunRepeatFX(LogicEntity e) { GlobalVFX.PlayStunnedParticles(e.position.value.ToVector3()); }
public virtual void OnFreeze(LogicEntity entity, int value) { sr.material.SetFloat("_InvertColors", 1); }
private void HitLevelFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(HatSounds.LEVEL_HIT_SOUND, go); }
public virtual void OnFreezeRemoved(LogicEntity entity) { sr.material.SetFloat("_InvertColors", 0); }
private void HitHatFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(HatSounds.HAT_HIT_SOUND, go); }
public virtual void OnStunnedRemoved(LogicEntity entity) { prefabManager.ManageGameObject("Stun_FX", false); }
private void FrictionFX(LogicEntity obj) { }
public virtual void OnInvincibleRemoved(LogicEntity entity) { sr.material.SetColor("_OverrideColor", new Color(1, 1, 1, 0)); }
private void HatDeathFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(HatSounds.DEATH_SOUND, go); }
public virtual void OnDead(LogicEntity entity) { prefabManager.ManageGameObject("Soul", true); prefabManager.InitializeGameObject("Soul", entity, transform); }
private void PickUpFX(LogicEntity obj) { AudioManager.singleton.PostWwiseEvent(HatSounds.PICKUP_SOUND, go); }
public virtual void OnDeadRemoved(LogicEntity entity) { }
public LogicTransform(LogicEntity entity, SafeV3 pos) : base(entity) { this.position = pos; }
public virtual void Update(bool condition, LogicEntity e) { }
public void EmptyFunction(LogicEntity e) { //get required data from the entity }
public virtual void OnRotation(LogicEntity entity, long value) { rotation = value.ToFloat(); }