Example #1
0
    public void AddTileToPatch(GridTile newTile)
    {
        _allTiles.Add(newTile);
        GridTile_StaticAnomaly anomaly = newTile.GetComponent <GridTile_StaticAnomaly>();

        anomaly.anomalyTileDestroyed += OnTileDestroyed;
    }
Example #2
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        //When inside anomaly affected sector
        if (col.GetComponent <GridTile_Anomaly>() != null)
        {
            GridTile_Anomaly anomaly = col.GetComponent <GridTile_Anomaly>();
            ship.anomalyTile = anomaly;
            mM.ContactWithAnomalyNotif(ship, anomaly);
        }

        if (col.GetComponent <Planet_InteractionZone>() != null)
        {
            ship.planetInOrbit   = col.GetComponent <Planet_InteractionZone>().ParentPlanet;
            ship.isInPlanetOrbit = true;
        }

        if (col.GetComponent <DeployPoint>() != null)
        {
            ship.deployP         = col.GetComponent <DeployPoint>();
            ship.isInDeployPoint = true;
        }

        if (col.GetComponent <Cloud>() != null)
        {
            ship.isMoving  = false;
            ship.isInCloud = true;
            mM.ContactWithCloudNotif(ship);
        }

        GridTile_Planet planet = col.GetComponent <GridTile_Planet>();

        if (planet != null)
        {
            planet.RevealPlanet(false);
            ship.CheckForClients(planet);
        }

        GridTile_StaticAnomaly staticAnomaly = col.GetComponent <GridTile_StaticAnomaly>();

        if (staticAnomaly != null)
        {
            ship.DisableShip();
        }

        // Wormhole
        WormHole candidateWormhole = col.GetComponent <WormHole>();

        if (candidateWormhole != null)
        {
            // If collision with wormhole is NOT collision with the current RECEIVING wormhole
            if (candidateWormhole != ship.receiverWormhole)
            {
                // Assign references and call the ship function
                ship.senderWormhole   = col.GetComponent <WormHole>();
                ship.receiverWormhole = ship.senderWormhole.SisterWormHole;
                ship.EnterWormHole(ship.receiverWormhole);
                mM.ContactWithWormholeNotif(ship);
            }
        }
    }
Example #3
0
 private void OnTileDestroyed(GridTile_StaticAnomaly anomaly)
 {
     anomaly.anomalyTileDestroyed -= OnTileDestroyed;
     _allTiles.Remove(anomaly);
     AssignCandidateTiles();
 }