Exemple #1
0
 protected override ComponentActivity[] GetActivities(ShipComponentBehaviour shipComponent)
 {
     return(new ComponentActivity[]
     {
         new ContinuousComponentActivity <ShipComponentBehaviour>(shipComponent, () => true, Move)
     });
 }
Exemple #2
0
    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);
    }
Exemple #3
0
        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)
            });
        }
Exemple #4
0
        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)
            });
        }
Exemple #5
0
    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);
        }
    }
Exemple #6
0
 public void SetMaster(ShipComponentBehaviour master)
 {
     connector = new ComponentConnector();
     item.SetConnector(connector, master);
 }
Exemple #7
0
 public void SetComponent(ShipComponentBehaviour component, ComponentActivity[] activities, Action disabledEvent, Action enabledEvent)
 {
 }
Exemple #8
0
 protected override void OnDisabled(ShipComponentBehaviour shipComponent)
 {
     ((ShieldComponentBehaviour)shipComponent).Disable();
 }
Exemple #9
0
 void Move(ShipComponentBehaviour master, float rate, float timeSpend)
 {
     rate *= timeSpend;
     master.driver.Move(movementSpeed * rate);
     master.driver.Rotate(rotationSpeed * rate);
 }
Exemple #10
0
 protected override void OnEnabled(ShipComponentBehaviour shipComponent)
 {
     ((EngineComponentBehaviour)shipComponent).Enable();
 }
Exemple #11
0
 protected virtual void OnEnabled(ShipComponentBehaviour shipComponent)
 {
 }
Exemple #12
0
 protected virtual ComponentActivity[] GetActivities(ShipComponentBehaviour shipComponent)
 {
     return(new ComponentActivity[0]);
 }
Exemple #13
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);
 }