Example #1
0
    public void RotateShipCondition(string arg, Dictionary <string, string> args)
    {
        float target = 180f;

        if (args.ContainsKey("TargetRotation"))
        {
            float.TryParse(args["TargetRotation"], out target);
        }
        else
        {
            float.TryParse(arg, out target);
        }

        bool showTutorial = false;

        if (args.ContainsKey("Tutorial"))
        {
            try
            {
                showTutorial = Convert.ToBoolean(args["Tutorial"]);
            }
            catch (Exception)
            {
                throw;
            }
        }

        if (showTutorial)
        {
            if (!rotateTutorial)
            {
                rotateTutorial = Instantiate(shipRotateTutorialPrefab);
            }
            rotateTutorial.gameObject.SetActive(true);
        }


        arenaHandler.GetSectorByNearestRotation(target).StartPhaseSector();
        shipController.onEndRotate.AddListener(OnShipSnap);
        gameplayInterface.spaceshipInterface.onBeginDrag.AddListener(OnShipRotating);
    }