public void ServerWriteInfect(IWriteMessage msg, UInt16 itemID, bool infect, BallastFloraBranch infector = null) { msg.Write(itemID); msg.Write(infect); if (infect) { msg.Write(infector?.ID ?? -1); } }
private bool TryScanTargets(BallastFloraBranch branch) { if (ScanForTargets(branch) is { } newTarget) { Behavior.StateMachine.EnterState(new GrowToTargetState(Behavior, branch, newTarget)); return(true); } return(false); }
private void CreateDeathParticle(BallastFloraBranch branch) { Vector2 pos = GetWorldPosition() + branch.Position; int amount = (int)Math.Clamp(branch.MaxHealth / 10f, 1, 10); for (int i = 0; i < amount; i++) { foreach (DamageParticle particle in DeathParticles) { particle.Emit(pos); } } }
public void ServerWriteBranchGrowth(IWriteMessage msg, BallastFloraBranch branch, int parentId = -1) { var(x, y) = branch.Position; msg.Write(parentId); msg.Write((int)branch.ID); msg.WriteRangedInteger((byte)branch.Type, 0b0000, 0b1111); msg.WriteRangedInteger((byte)branch.Sides, 0b0000, 0b1111); msg.WriteRangedInteger(branch.FlowerConfig.Serialize(), 0, 0xFFF); msg.WriteRangedInteger(branch.LeafConfig.Serialize(), 0, 0xFFF); msg.Write((ushort)branch.MaxHealth); msg.Write((int)(x / VineTile.Size)); msg.Write((int)(y / VineTile.Size)); }
public DefendWithPumpState(BallastFloraBranch branch, List <Item> items, Character attacker) { targetBranch = branch; this.attacker = attacker; foreach (Item item in items) { if (item.GetComponent <Pump>() is { } pump) { allAvailablePumps.Add(pump); } if (item.GetComponent <Door>() is { } door) { allAvailableDoors.Add(door); } } }
public GrowToTargetState(BallastFloraBehavior behavior, BallastFloraBranch starter, Item target) : base(behavior) { Target = target; TargetBranches.Add(starter); }
public void ServerWriteBranchRemove(IWriteMessage msg, BallastFloraBranch branch) { msg.Write(branch.ID); }
public void ServerWriteBranchDamage(IWriteMessage msg, BallastFloraBranch branch, float damage) { msg.Write((int)branch.ID); msg.Write(damage); msg.Write(branch.Health); }