/** * Activates the node if shot with the proper laser. If a platformMaker node, sets the node to the player's most recently shot, * to be paired with the next node shot. If the path between platform nodes is obscured, they are both deactivated. */ private void OnTriggerEnter2D(Collider2D collision) { if (collision.GetComponent <Projectile>() == null) { return; } Projectile p = collision.GetComponent <Projectile>(); if (p.projectileType != ProjectileType.platformMaker && nodeType == ProjectileType.platformMaker) { return; } if (inUse) { return; } if (nodeType == ProjectileType.platformMaker) { Select(); if (Player.instance.selectedNode == null || Player.instance.selectedNode.nodeType != nodeType) { Player.instance.selectedNode = this; } else if (Player.instance.selectedNode != this) { Vector3 direction = Player.instance.selectedNode.transform.position - transform.position; float distance = Vector2.Distance(Player.instance.selectedNode.transform.position, transform.position); GameObject ray = NodeLinks.instance.connectionRayPool.ActivateObject(transform.position); ray.GetComponent <NodeConnectionRay>().TryConnection(this, Player.instance.selectedNode, direction); ray.transform.up = -direction; } } else if (nodeType == ProjectileType.data && p.projectileType == ProjectileType.data && inUse == false) { inUse = true; Activate(); dataGoal.ActivateNode(); } }