Esempio n. 1
0
    public void Init()
    {
        if (ParentCloud != null)
        {
            poolObjectManager.ParentGO = ParentCloud;
        }
        if (CloudsToSpawn != null)
        {
            poolObjectManager.SetTargetList(CloudsToSpawn);
            poolObjectManager.Number = 20;
            Debug.Log("Object setting success");
            poolObjectManager.Init();
        }
        else
        {
            Debug.Log("Cant initialize CloudSpawning");
            didInit = false;
            return;
        }

        foreach (GameObject v in poolObjectManager.gameObjectList)
        {
            rb            = ExtendedGameObject.SetComponent <Rigidbody>(v);
            rb.useGravity = false;
            rb.mass       = 0.01f;
        }

        didInit = true;
    }
Esempio n. 2
0
    public void Init()
    {
        MainMenuCanvas.enabled   = true;
        MainSettingsMenu.enabled = false;

        if (SceneManagerGO == null)
        {
            SceneManagerGO = GameObject.Find("SceneManager");
        }
        if (SceneManagerGO == null)
        {
            Debug.Log("Cant find SceneManagerGO");
        }

        customSceneManager = ExtendedGameObject.SetComponent <CustomSceneManager>(SceneManagerGO);
        customSceneManager.SetScenesArray(SceneNames);
        customSceneManager.Init();

        Score.text = GetHighScore().ToString();

        if (PlayerPrefs.GetInt("SRT_ALOWSOUND", 0) == 0)
        {
            SoundStatus.text = "Sound OFF";
        }
        else
        {
            SoundStatus.text = "Sound ON";
        }


        didInit = true;
    }
Esempio n. 3
0
    void Init()
    {
        myTransform = transform;
        canMove     = true;

        canJumpAgain      = true;
        canSlideAgain     = true;
        canRollLeftAgain  = true;
        canRollRightAgain = true;

#if UNITY_EDITOR
        keyboardInput = ExtendedGameObject.SetComponent <Keyboard_Input>(gameObject);
#elif UNITY_ANDROID
        touchInput = ExtendedGameObject.SetComponent <TouchInput>(gameObject);
#endif

        anim = ExtendedGameObject.SetComponent <Animator>(gameObject);

        MainCameraGO = GameObject.Find("Main Camera");
        if (MainCameraGO == null)
        {
            Debug.Log("Cant find main camera");
            return;
        }
        cameraFollower = ExtendedGameObject.SetComponent <CameraFollower>(MainCameraGO);
        cameraFollower.followTarget = gameObject.transform;

        capCollider = ExtendedGameObject.SetComponent <CapsuleCollider>(gameObject);
        base.Init();

        MakeUninvisible();

        didInit = true;
    }
Esempio n. 4
0
    public void Init()
    {
        // SpeedVecFE_GC = new Vector3(0, 0, -15f);
        feManager = gameObject.AddComponent <FEManager>();
        feManager.StartPointAllFE            = PointStartFE_GC;
        feManager.EndPointAllFE              = PointEndFE_GC;
        feManager.SpeedVecFE                 = PointEndFE_GC;
        feManager.ShouldExtend               = false;
        feManager.TargetGameObjects          = TargetsFE;
        feManager.PoolSizeFE                 = NumberOfFE;
        feManager.poolObjectManager.ParentGO = FEParentGO;

        feManager.Init();

        focusPlayerScript = ExtendedGameObject.SetComponent <PlayerController>(PlayerPrefab);
        focusPlayerScript.CameraOffSet = CameraOffSet_GC;
        focusPlayerScript.DataManager.SetHealth(3);


        uiDataManager               = ExtendedGameObject.SetComponent <BaseUIDataManager>(gameObject);
        uiDataManager.ScoreField    = Score;
        uiDataManager.Health1       = HP1;
        uiDataManager.Health2       = HP2;
        uiDataManager.Health3       = HP3;
        uiDataManager.player_lives  = focusPlayerScript.DataManager.GetHealth();
        uiDataManager.gamePrefsName = "SRT";

        mainSound = ExtendedGameObject.SetComponent <AudioSource>(gameObject);
        if (PlayerPrefs.GetInt("SRT_ALOWSOUND", 0) == 0)
        {
            mainSound.Stop();
        }
        else
        {
            mainSound.Play();
        }

        #region CloudSystem Initializing and starting
        cloudSpawning               = ExtendedGameObject.SetComponent <CloudSpawning>(gameObject);
        cloudSpawning.ParentCloud   = CloudParentGO;
        cloudSpawning.CloudsToSpawn = Clouds;
        cloudSpawning.Init();
        cloudSpawning.TimeDelay  = 5.5f;
        cloudSpawning.StartPoint = CloudStartingPoint;
        cloudSpawning.Speed      = new Vector3(0, 0, -400f);
        cloudSpawning.StartCloudMovement();
        #endregion

        #region EventHandlers
        PlayerController.PlayerHittedLevel += PlayerLostLifeHandler;
        #endregion
        IsDebug = true;

        didInit = true;
    }
Esempio n. 5
0
    public void Start()
    {
        mainSound = ExtendedGameObject.SetComponent <AudioSource>(gameObject);
        if (mainSound == null)
        {
            Debug.Log("SoundManager: cant find mainSound");
        }
        if (!PlayerPrefs.HasKey(SoundPrefs))
        {
            PlayerPrefs.SetInt(SoundPrefs, 1);
        }

        if (PlayerPrefs.GetInt(SoundPrefs, 0) == 0)
        {
            mainSound.Stop();
        }
        else
        {
            mainSound.Play();
        }
    }
Esempio n. 6
0
        public void SetupObjectForAnimation(ExtendedGameObject intake)
        {
            if (intake.objAnim == null)
            {
                intake.objAnim = intake.gameObject.AddComponent <AnimatedObject>();
            }

            if (intake.objAnim.childName == null || intake.objAnim.childName == "")
            {
                intake.objAnim.childName = "Animated Object";
            }
            intake.objAnim.childParent = managerName;

            intake.objAnim.parent            = intake;
            intake.objAnim.initialAnimations = new List <CustomAnimation>();

            foreach (string temp in intake.objectAnimations)
            {
                CustomAnimation newAnimation = intake.gameObject.AddComponent <CustomAnimation>();

                newAnimation.animName = temp;
                newAnimation.objAnim  = intake.objAnim;

                newAnimation.childName   = newAnimation.animName;
                newAnimation.childParent = intake.objAnim.childName;

                intake.objAnim.initialAnimations.Add(newAnimation);

                InitializeChildrenScripts(newAnimation);

                if (intake.animateLeftRightSame)
                {
                    if (temp.Length > 8)
                    {
                        string newString = temp.Substring(temp.Length - 7, 6);

                        if (newString == "R Base" || newString == "L Base")
                        {
                            newAnimation.animName.Remove(newAnimation.animName.Length - 6, 5);

                            CustomAnimation newAnimation2 = intake.gameObject.AddComponent <CustomAnimation>();

                            newAnimation2.objAnim = intake.objAnim;

                            newAnimation2.animName = temp;
                            newAnimation2.animName.Remove(newAnimation2.animName.Length - 7, 6);
                            newAnimation2.animName += "L";

                            newAnimation2.childName   = newAnimation.animName;
                            newAnimation2.childParent = intake.objAnim.childName;

                            newAnimation2.flipped = true;

                            intake.objAnim.initialAnimations.Add(newAnimation2);

                            InitializeChildrenScripts(newAnimation2);

                            if (newString == "R Base")
                            {
                                newAnimation2.animName += "L";
                            }
                            else if (newString == "L Base")
                            {
                                newAnimation2.animName += "R";
                            }
                        }
                    }
                }

                InitializeChildrenScripts(intake.objAnim);
            }
        }