Beispiel #1
0
    void Init()
    {
        s_Player       = GameObject.Find("Stage6").transform.FindChild("Player").GetComponent <PlayerControl>();
        s_Ove          = GameObject.Find("Stage6").transform.FindChild("Ove").GetComponent <Ove>();
        s_Flower1      = GameObject.Find("Stage6").transform.FindChild("SmallFlower1").GetComponent <Flower>();
        s_Flower2      = GameObject.Find("Stage6").transform.FindChild("SmallFlower2").GetComponent <Flower>();
        s_Flower3      = GameObject.Find("Stage6").transform.FindChild("SmallFlower3").GetComponent <Flower>();
        s_Tower        = GameObject.Find("Stage6").transform.FindChild("Tower").GetComponent <Tower>();
        s_Switch1      = GameObject.Find("Stage6").transform.FindChild("Switch1").GetComponent <Switch>();
        s_Switch       = GameObject.Find("Stage6").transform.FindChild("Switch").GetComponent <Switch>();
        s_RotateStep1  = GameObject.Find("Stage6").transform.FindChild("RotateStep1").GetComponent <RotateStep>();
        s_RotateStep2  = GameObject.Find("Stage6").transform.FindChild("RotateStep2").GetComponent <RotateStep>();
        s_RotateStep3  = GameObject.Find("Stage6").transform.FindChild("RotateStep3").GetComponent <RotateStep>();
        s_StageManager = GameObject.Find("Stage").GetComponent <StageManager>();
        s_Ladder       = GameObject.Find("Stage6").transform.FindChild("Ladder").GetComponent <Ladder>();

        s_Player.Init();
        s_Player.transform.position = new Vector3(5.1f, -28.5f, 0);
        s_Ove.Init();
        s_Ove.transform.position = new Vector3(17, -32.1f, -1);
        s_Flower1.Init();
        s_Flower2.Init();
        s_Flower3.Init();
        s_Tower.Init();
        s_Switch.Init();
        s_Switch1.Init();
        s_Ladder.Init();
        s_RotateStep1.Init();
        s_RotateStep2.Init();
        s_RotateStep3.Init();
    }
        private void RotateText(TextFigure tf, Point pos)
        {
            if (_nowRotating == null)
            {
                var snappedTo = StepManager.SnapTo(pos, tf.GetMagnets(), tf.Center);
                if (snappedTo == tf.Start)
                {
                    var angle = Utils.AngleBetween(tf.X.CachedValue.AsDouble + tf.Width.CachedValue.AsDouble - pos.X,
                                                   tf.Y.CachedValue.AsDouble + tf.Height.CachedValue.AsDouble - pos.Y,
                                                   tf.Width.CachedValue.AsDouble,
                                                   tf.Height.CachedValue.AsDouble);

                    _nowRotating = new RotateTextStep(tf, RotateTextStep.Side.End,
                                                      angle / (2 * Math.PI));
                }
                else if (snappedTo == tf.End)
                {
                    var angle = Utils.AngleBetween(pos.X - tf.X.CachedValue.AsDouble, pos.Y - tf.Y.CachedValue.AsDouble,
                                                   tf.Width.CachedValue.AsDouble, tf.Height.CachedValue.AsDouble);

                    _nowRotating = new RotateTextStep(tf, RotateTextStep.Side.Start,
                                                      angle / (2 * Math.PI));
                }
                if (_nowRotating == null)
                {
                    return;
                }
                _originalX = tf.X.CachedValue.AsDouble;
                _originalY = tf.Y.CachedValue.AsDouble;
                _originalW = tf.Width.CachedValue.AsDouble;
                _originalH = tf.Height.CachedValue.AsDouble;
                StepManager.InsertNext(_nowRotating);
            }
            else
            {
                var rls = (RotateTextStep)_nowRotating;

                if (rls.RotateAround == RotateTextStep.Side.Start)
                {
                    var angle = Utils.AngleBetween(pos.X - _originalX, pos.Y - _originalY,
                                                   _originalW, _originalH);

                    rls.Rotate(angle / (2 * Math.PI));
                }
                else if (rls.RotateAround == RotateTextStep.Side.End)
                {
                    var angle = Utils.AngleBetween(_originalX + _originalW - pos.X,
                                                   _originalY + _originalH - pos.Y,
                                                   _originalW, _originalH);

                    rls.Rotate(angle / (2 * Math.PI));
                }
            }
        }
Beispiel #3
0
    void Init()
    {
        s_Player       = GameObject.Find("Stage9").transform.FindChild("Player").GetComponent <PlayerControl>();
        s_Ove          = GameObject.Find("Stage9").transform.FindChild("Ove").GetComponent <Ove>();
        s_Ladder       = GameObject.Find("Stage9").transform.FindChild("Ladder").GetComponent <Ladder>();
        s_Flower1      = GameObject.Find("Stage9").transform.FindChild("SmallFlower1").GetComponent <Flower>();
        s_Flower2      = GameObject.Find("Stage9").transform.FindChild("SmallFlower2").GetComponent <Flower>();
        s_Flower3      = GameObject.Find("Stage9").transform.FindChild("SmallFlower3").GetComponent <Flower>();
        s_Tower        = GameObject.Find("Stage9").transform.FindChild("Tower").GetComponent <Tower>();
        s_RailStep1    = GameObject.Find("Stage9").transform.FindChild("RailStep1").GetComponent <RailStep>();
        t_TimeStep1    = GameObject.Find("Stage9").transform.FindChild("TimeStep1").transform;
        t_TimeStep2    = GameObject.Find("Stage9").transform.FindChild("TimeStep2").transform;
        s_StageManager = GameObject.Find("Stage").GetComponent <StageManager>();
        s_Switch       = GameObject.Find("Stage9").transform.FindChild("Switch").GetComponent <Switch>();
        s_Switch2      = GameObject.Find("Stage9").transform.FindChild("Switch2").GetComponent <Switch>();
        s_Switch3      = GameObject.Find("Stage9").transform.FindChild("Switch3").GetComponent <Switch>();
        s_Switch4      = GameObject.Find("Stage9").transform.FindChild("Switch4").GetComponent <Switch>();
        s_RotateStep   = GameObject.Find("Stage9").transform.FindChild("ShortRotateStep").GetComponent <RotateStep>();

        s_Player.Init();
        s_Player.transform.position = new Vector3(3.5f, -32.9f, 0);
        s_Ove.Init();
        s_Ove.transform.position = new Vector3(9, -35.6f, -1);
        s_Ladder.Init();
        s_Flower1.Init();
        s_Flower2.Init();
        s_Flower3.Init();
        s_Tower.Init();
        s_RailStep1.Init();
        s_Switch.Init();
        s_Switch2.Init();
        s_Switch3.Init();
        s_Switch4.Init();
        s_RotateStep.Init();

        s_Tower.gameObject.SetActive(false);
        t_TimeStep1.gameObject.SetActive(false);
        t_TimeStep2.gameObject.SetActive(false);
    }
Beispiel #4
0
    void Init()
    {
        s_Player       = GameObject.Find("Stage4").transform.FindChild("Player").GetComponent <PlayerControl>();
        s_Switch       = GameObject.Find("Stage4").transform.FindChild("Switch").GetComponent <Switch>();
        s_Switch1      = GameObject.Find("Stage4").transform.FindChild("Switch1").GetComponent <Switch>();
        s_Tower        = GameObject.Find("Stage4").transform.FindChild("Tower").GetComponent <Tower>();
        s_Ove          = GameObject.Find("Stage4").transform.FindChild("Ove").GetComponent <Ove>();
        s_Flower1      = GameObject.Find("Stage4").transform.FindChild("SmallFlower1").GetComponent <Flower>();
        s_Flower2      = GameObject.Find("Stage4").transform.FindChild("SmallFlower2").GetComponent <Flower>();
        s_Flower3      = GameObject.Find("Stage4").transform.FindChild("SmallFlower3").GetComponent <Flower>();
        s_RotateStep1  = GameObject.Find("Stage4").transform.FindChild("RotateStep1").GetComponent <RotateStep>();
        s_RotateStep2  = GameObject.Find("Stage4").transform.FindChild("RotateStep2").GetComponent <RotateStep>();
        s_Ladder1      = GameObject.Find("Stage4").transform.FindChild("Ladder1").GetComponent <Ladder>();
        s_Ladder2      = GameObject.Find("Stage4").transform.FindChild("Ladder2").GetComponent <Ladder>();
        s_StageManager = GameObject.Find("Stage").GetComponent <StageManager>();
        t_LadderCheck1 = GameObject.Find("Stage4").transform.FindChild("LadderCheck1").transform;
        t_LadderCheck2 = GameObject.Find("Stage4").transform.FindChild("LadderCheck2").transform;

        s_Player.Init();
        s_Player.transform.position = new Vector3(4.4f, -36.6f, -1);
        s_Switch.Init();
        s_Switch1.Init();
        s_Tower.Init();
        s_Ove.Init();
        s_Ove.transform.position = new Vector3(16.5f, -40, -2);
        s_Flower1.Init();
        s_Flower2.Init();
        s_Flower3.Init();
        s_RotateStep1.Init();
        s_RotateStep2.Init();
        s_Ladder1.Init();
        s_Ladder2.Init();

        s_Ladder1.gameObject.SetActive(false);
        s_Ladder2.gameObject.SetActive(false);
        t_LadderCheck1.gameObject.SetActive(true);
        t_LadderCheck2.gameObject.SetActive(true);
    }
 public bool Reset()
 {
     _nowRotating = null;
     return(_moved);
 }