public void ExecuteOption(OptionAndParams item) { // No options when in invalid state such as sunk. if (!IsValidState()) { return; } if (item.Option == UnitOption.WS_FIRE_AT && !Firing) { // We are now firing, determine the target... Firing = true; bool isUnit = item.Params.IsOfType <GameObject>(0); if (isUnit) { // Targeting a unit... var go = item.Params.Get <GameObject>(0); if (go != null) { Unit unit = go.GetComponent <Unit>(); TargetUnit = unit; } } else { // Targeting a static position. TargetUnit = null; TargetPosition = item.Params.Get <Vector2>(0); } } if (item.Option == UnitOption.WS_CEASE_FIRE && Firing) { Firing = false; TargetUnit = null; } }
public void ExecuteOption(OptionAndParams option) { // Below: only if not broken. if (IsPhysicallyBroken()) { return; } if (option.Option == UnitOption.SHIP_STOP_ENGINE) { if (Active) { Deactivate(); } } if (option.Option == UnitOption.SHIP_START_ENGINE) { if (!Active) { Activate(); } } }
public void ExecOption(OptionAndParams option) { BroadcastMessage("ExecuteOption", option, SendMessageOptions.DontRequireReceiver); }