Example #1
0
    public void Add(IThruster thruster)
    {
        var orientation      = ((IBlock)thruster).blockBaseClass.orientation;
        var tempThrustVector = thrustVectors[orientation];

        tempThrustVector.AddToGroup(thruster);
        thrustVectors[orientation] = tempThrustVector;
    }
Example #2
0
    public void Remove(IThruster thruster)
    {
        var orientation      = ((IBlock)thruster).blockBaseClass.orientation;
        var tempThrustVector = thrustVectors[orientation];

        tempThrustVector.RemoveFromGroup(thruster);
        thrustVectors[orientation] = tempThrustVector;
    }
Example #3
0
        private ThrusterAxis SelectAxis(IThruster thruster, out bool positiveAxisComponent)
        {
            var block     = thruster.Component.block;
            var direction = block.BlueprintBlock.Direction;

            positiveAxisComponent = direction <= 1;
            return(direction % 2 == 0 ? xAxis : yAxis);
        }
Example #4
0
        private ThrusterGroup SelectGroup(IThruster thruster)
        {
            var rotation = GetDirection(thruster);

            try {
                return(thrusterDict[rotation]);
            }
            catch (KeyNotFoundException) {
                Debug.LogWarning(
                    $"thruster {thruster} with rotation {rotation} cannot find a corresponding thruster group");
                return(null);
            }
        }
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        if (mThruster == null)
        {
            mThruster = GetComponent <IThruster>();
        }

        if (mTurner == null)
        {
            mTurner = GetComponent <ITurner>();
        }

        if (mShooter == null)
        {
            mShooter = GetComponent <IShooter>();
        }
    }
Example #6
0
 public void RemoveFromGroup(IThruster thruster)
 {
     thrusterMembers.Remove(thruster);
     thrust       -= thruster.thrust;
     _consumption -= thruster.powerConsumption;
 }
Example #7
0
 public void AddToGroup(IThruster thruster)
 {
     thrusterMembers.Add(thruster);
     thrust       += thruster.thrust;
     _consumption += thruster.powerConsumption;
 }
Example #8
0
 public void Unregister(IThruster thruster, bool positiveComponent)
 {
     SelectGroup(positiveComponent).Remove(thruster);
 }
Example #9
0
 public void Register(IThruster thruster, bool positiveComponent)
 {
     SelectGroup(positiveComponent).Add(thruster);
 }
Example #10
0
 public void Unregister(IThruster thruster)
 {
     SelectAxis(thruster, out var component).Unregister(thruster, component);
 }
Example #11
0
 public void SetThruster(IThruster t)
 {
     mThruster = t;
 }
 private void Start()
 {
     _thruster = Thruster.GetComponent <IThruster>();
 }
Example #13
0
 private int GetDirection(IThruster thruster)
 {
     return(thruster.Component.block.anchoredBlueprintBlock.blueprintBlock.Direction);
 }
Example #14
0
 public void Unregister(IThruster thruster)
 {
     SelectGroup(thruster)?.Remove(thruster);
 }
Example #15
0
 public void Register(IThruster thruster)
 {
     SelectGroup(thruster)?.Add(thruster);
 }