protected override ComponentActivity[] GetActivities(ShipComponentBehaviour shipComponent) { return(new ComponentActivity[] { new ContinuousComponentActivity <ShipComponentBehaviour>(shipComponent, () => true, Move) }); }
public ShipComponentBehaviour SetTackle(int place, SystemLink link) { ShipComponentBehaviour tackle = ShipComponentBehaviour.InstantiateBehaviour(link, tackles[place]); tackle.transform.SetParent(transform); Destroy(tackles[place].gameObject); tackles[place] = tackle.GetComponent <TacklePlaceBehaviour>(); return(tackle); }
protected override ComponentActivity[] GetActivities(ShipComponentBehaviour shipComponent) { PlasmaGunComponentBehaviour gun = (PlasmaGunComponentBehaviour)shipComponent; return(new ComponentActivity[] { new ContinuousComponentActivity <PlasmaGunComponentBehaviour>(gun, gun.IsDirecting, Direct), new TimerComponentActivity <PlasmaGunComponentBehaviour>(gun, .2f + .2f * shipClass, gun.IsFiring, Fire) }); }
protected override ComponentActivity[] GetActivities(ShipComponentBehaviour shipComponent) { FreezeRayComponentBehaviour rayGun = (FreezeRayComponentBehaviour)shipComponent; return(new ComponentActivity[] { new ContinuousComponentActivity <FreezeRayComponentBehaviour>(rayGun, rayGun.IsDirecting, Direct), new ContinuousComponentActivity <FreezeRayComponentBehaviour>(rayGun, rayGun.IsFiring, Fire) }); }
void SetComponentDamage(float damage, ShipController offender, ShipComponentBehaviour component) { if (!state.takeDamage) { return; } bool wasAlive = alive; component.TakeDamage(damage); DamageHull(damage); if (offender != null) { AddOffender(damage, offender); } if (wasAlive != alive) { AddToDead(offender); } }
public void SetMaster(ShipComponentBehaviour master) { connector = new ComponentConnector(); item.SetConnector(connector, master); }
public void SetComponent(ShipComponentBehaviour component, ComponentActivity[] activities, Action disabledEvent, Action enabledEvent) { }
protected override void OnDisabled(ShipComponentBehaviour shipComponent) { ((ShieldComponentBehaviour)shipComponent).Disable(); }
void Move(ShipComponentBehaviour master, float rate, float timeSpend) { rate *= timeSpend; master.driver.Move(movementSpeed * rate); master.driver.Rotate(rotationSpeed * rate); }
protected override void OnEnabled(ShipComponentBehaviour shipComponent) { ((EngineComponentBehaviour)shipComponent).Enable(); }
protected virtual void OnEnabled(ShipComponentBehaviour shipComponent) { }
protected virtual ComponentActivity[] GetActivities(ShipComponentBehaviour shipComponent) { return(new ComponentActivity[0]); }
public void SetConnector(ComponentConnector connector, ShipComponentBehaviour shipComponent) { connector.SetComponent(this, GetActivities(shipComponent), () => OnDisabled(shipComponent), () => OnEnabled(shipComponent)); }
void Accelerate(ShipComponentBehaviour master, float rate, float dt) { master.driver.Accelerate(multiply * rate); }