// TODO: clean up the casting in this method public bool EntityInteraction(NewPackets.EntityInteraction parameters) { //Debug.Log($"Entity Interaction | E1: {FactionID} {parameters.myEntityIndex} | E2: {parameters.otherFactionIndex} {parameters.otherEntityIndex}!"); ICarrier carrier = Entities[parameters.myEntityIndex] as ICarrier; if (carrier == null) { return(false); } if (parameters.otherFactionIndex == 0) // Entity is in the neutral faction (pickup) { carrier.Carry(GameManager.PlayerFactions[0].Entities[parameters.otherEntityIndex]); } else if (parameters.otherFactionIndex == FactionID) // Entity is in own faction { if (parameters.myEntityIndex == parameters.otherEntityIndex) // "self click" defines a pop-deploy request { carrier.TryDeploy(); } else // Otherwise pass { carrier.Pass(Entities[parameters.otherEntityIndex]); } } return(true); }
public void CustomDeploy(NewPackets.Deploy parameters) { if (Entities[parameters.EntityID] == null) { Debug.Log("ERROR: invalid deploy request; null entity"); return; } ICarrier carrier = Entities[parameters.EntityID] as ICarrier; if (carrier != null) { Debug.Log("Valid custom deploy detected from commandable entity : " + Entities[parameters.EntityID].GetType()); carrier.TryDeploy(parameters.InventoryID); } }