コード例 #1
0
    void Launch(PathScript path)
    {
        ShipScript ship = planetScript.ships [Indices.SHIP_PLAYER];

        ship.gameObject.SetActive(true);
        AbstractPlanet targetPlanet = path.GetDirectionStartingFrom(transform).end.gameObject.GetComponent <AbstractPlanet>();

        if (targetPlanet != null)
        {
            ship.LaunchShipOnPath(path, transform, targetPlanet);
        }
    }
コード例 #2
0
    void LaunchShip(AbstractPlanet planet, AbstractPlanet target, PathScript[] paths, ShipScript ship)
    {
        PathScript chosenPath = null;

        foreach (PathScript path in paths)
        {
            if ((path.start == planet.transform && path.end == target.transform) ||
                (path.end == planet.transform && path.start == target.transform))
            {
                chosenPath = path;
                break;
            }
        }
        ship.LaunchShipOnPath(chosenPath, planet.transform, target);
    }