コード例 #1
0
ファイル: Animation.cs プロジェクト: LadyRavenFire/Test-task
    void Start()
    {
        _IsLeftMoving = _relative.GetComponent <IsLeftMoving>();
        _image        = gameObject.GetComponent <Image>();
        _rotationY    = gameObject.transform.rotation.y;

        Rotation();
    }
コード例 #2
0
    void SpawnLeftRightMovingObject(GameObject Object, int BorderOfScreen)
    {
        _delay = Random.Next(0, 3);
        int leftRight      = Random.Next(0, 2);
        int borderOfScreen = BorderOfScreen;

        int yCoord    = (int)Random.Next(0 + borderOfScreen, Screen.height - borderOfScreen);
        var newObject = Instantiate(Object, new Vector3(10, 10, 0), Quaternion.identity) as GameObject;

        newObject.transform.SetParent(_mainCanvas.transform, false);

        if (leftRight == 0)
        {
            newObject.transform.position = new Vector3(Screen.width + (Screen.width * 0.1f), yCoord, 0);
        }
        else
        {
            newObject.transform.position = new Vector3(-(Screen.width * 0.1f), yCoord, 0);
            IsLeftMoving IsLeftMoving = newObject.GetComponent <IsLeftMoving>();
            IsLeftMoving.IsLeft = false;
        }
    }