Exemple #1
0
    void Interact()
    {
        Collider2D hitComponent = Physics2D.OverlapCircle(transform.position, interactRadius, shipComponentsMasks);

        if (hitComponent == null)
        {
            return;
        }

        ShipComponent shipComponent = hitComponent.GetComponent <ShipComponent>();

        if (shipComponent == null)
        {
            Debug.LogWarning($"Player interacted with object {hitComponent.name} but it did not have a ShipComponent attached to it.");
            return;
        }

        shipComponent.Interact();
        BreakableComponent breakable = shipComponent.GetComponent <BreakableComponent>();

        if (breakable)
        {
            progressBar.gameObject.SetActive(true);
        }
        focus = shipComponent;
    }
	public override void ApplyUpgrade (ShipComponent comp) {
		Wings w = comp.GetComponent (typeName) as Wings;
		if(!w)
			return;
		
		w.colSelfMult = 1-colSelfMult;
		w.colVictimMult = 1+colVictimMult;
	}
Exemple #3
0
	public override void ApplyUpgrade (ShipComponent comp)
	{
		Engine e = comp.GetComponent (typeName) as Engine;
		if(!e)
			return;

		e.maxSpeed *= 1+maxMult;
		e.thrustMult *= 1+accMult;
	}
Exemple #4
0
	public override void ApplyUpgrade (ShipComponent comp)
	{
		Hull h = comp.GetComponent (typeName) as Hull;
		if(!h)
			return;

		h.maxHealth *= 1+healthMult;
		h.maxCapacity *= 1+capacityMult;
	}
Exemple #5
0
 void ApplyUpgrades(ShipComponent c)
 {
     foreach (Upgrade u in upgrades)
     {
         if (c.GetComponent(u.typeName) && u.bought)
         {
             u.ApplyUpgrade(c);
         }
     }
 }
Exemple #6
0
    public override void ApplyUpgrade(ShipComponent comp)
    {
        Engine e = comp.GetComponent(typeName) as Engine;

        if (!e)
        {
            return;
        }

        e.maxSpeed   *= 1 + maxMult;
        e.thrustMult *= 1 + accMult;
    }
Exemple #7
0
    public override void ApplyUpgrade(ShipComponent comp)
    {
        Hull h = comp.GetComponent(typeName) as Hull;

        if (!h)
        {
            return;
        }

        h.maxHealth   *= 1 + healthMult;
        h.maxCapacity *= 1 + capacityMult;
    }
    public override void ApplyUpgrade(ShipComponent comp)
    {
        Wings w = comp.GetComponent(typeName) as Wings;

        if (!w)
        {
            return;
        }

        w.colSelfMult   = 1 - colSelfMult;
        w.colVictimMult = 1 + colVictimMult;
    }
Exemple #9
0
    void UpdatePlayer()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Interact();
        }

        // If Player is interacting with a ShipComponent object
        if (focus)
        {
            BreakableComponent breakable = focus.GetComponent <BreakableComponent>();
            if (breakable)
            {
                float progress = breakable.GetProgress();
                progressBar.SetProgress(progress);
            }

            // Check if it's too far away and cancel current progress
            if (Vector2.Distance(focus.transform.position, transform.position) > 1f)
            {
                if (breakable)
                {
                    progressBar.SetProgress(0f);
                    progressBar.gameObject.SetActive(false);
                }
                focus.Cancel();
                focus = null;
            }
        }

        if (!o2Active)
        {
            o2Current -= o2Multiplier * Time.deltaTime;
        }
        o2Bar.SetProgress(o2Current / o2TotalCapacity);
    }
Exemple #10
0
	void ApplyUpgrades(ShipComponent c) {
		foreach (Upgrade u in upgrades) {
			if (c.GetComponent(u.typeName)&&u.bought) {
				u.ApplyUpgrade(c);
			}
		}
	}
Exemple #11
0
 private void RemoveComponent(ShipComponent component)
 {
     component.ClearOwnerColour();
     component.GetComponent <SpriteRenderer>().sortingOrder = 0;
     component.transform.parent = null;
 }
Exemple #12
0
 private void AddComponent(ShipComponent component)
 {
     component.SetOwnerColour(colour);
     component.GetComponent <SpriteRenderer>().sortingOrder = component is Oar ? 2 : 1;
     component.transform.parent = transform;
 }