コード例 #1
0
        public void Start()
        {
            gameManager = GameManager.instance;
            dataManager = DataManager.instance;
            gameManager.OnPauseGame += GamePaused;

            activePowerUp = PowerUpTypes.None;
            activePowerUpData = new CoroutineData();
        }
コード例 #2
0
        public void Start()
        {
            thisTransform = transform;
            gameManager = GameManager.instance;
            cameraController = CameraController.instance;

            pool = new List<CoinValueObject>();
            poolIndex = 0;
            activeCoins = new List<CoinValueObject>();

            gameManager.OnPauseGame += GamePaused;
        }
コード例 #3
0
        public void Start()
        {
            thisTransform = transform;
            thisAnimation = GetComponent<Animation>();
            gameManager = GameManager.instance;

            thisTransform.position = spawnPosition;
            thisTransform.eulerAngles = spawnRotation;
            platformLayer = (1 << LayerMask.NameToLayer("Platform")) | (1 << LayerMask.NameToLayer("PlatformJump")) | (1 << LayerMask.NameToLayer("Floor"));

            // setup the animation wrap modes
            thisAnimation[idleAnimationName].wrapMode = WrapMode.Loop;
            thisAnimation[runAnimationName].wrapMode = WrapMode.Loop;
            thisAnimation[attackAnimationName].wrapMode = WrapMode.Once;
            thisAnimation.Play(idleAnimationName);

            GameManager.instance.OnStartGame += StartGame;
        }
コード例 #4
0
 public void Awake()
 {
     instance = this;
 }
コード例 #5
0
ファイル: PowerUpObject.cs プロジェクト: Maareks/Endless-Cat
 public void Start()
 {
     gameManager = GameManager.instance;
 }
コード例 #6
0
ファイル: GUIManager.cs プロジェクト: Maareks/Endless-Cat
        public void Start()
        {
            gameManager = GameManager.instance;
            dataManager = DataManager.instance;
            missionManager = MissionManager.instance;
            coinGUICollection = CoinGUICollection.instance;

            guiState = GUIState.MainMenu;
            inGamePowerUpData = new CoroutineData();
            gameManager.OnPauseGame += GamePaused;
            lastClickTime = -clickDelay;

            // hide everything except the main menu
            screenTouch.SetActive(false);
            mainMenuPanel.SetActive(true);
            logoPanel.SetActive(true);
            inGameLeftPanel.SetActive(false);
            inGameTopPanel.SetActive(false);
            inGameRightPanel.SetActive(false);
            if (revivePanel != null)
                revivePanel.SetActive(false);
            endGamePanel.SetActive(false);
            storePanel.SetActive(false);
            statsPanel.SetActive(false);
            missionsPanel.SetActive(false);
            if (inGameMissionsPanel != null)
                inGameMissionsPanel.SetActive(false);
            pausePanel.SetActive(false);
            tutorialPanel.SetActive(false);
        }
コード例 #7
0
        public virtual void Start()
        {
            gameManager = GameManager.instance;
            playerAnimation = PlayerController.instance.GetComponent<PlayerAnimation>();
            startLayer = gameObject.layer;

            if (destructionAnimation && isDestructible) {
                destructionAnimation[destructionAnimationName].wrapMode = WrapMode.Once;
                destructionDelay = new WaitForSeconds(0.2f);
            }

            collideWithPlayer = true;
        }
コード例 #8
0
        public void Init()
        {
            // deprecated variables warnings:
            if (jumpForce != 0 && jumpHeight == 0) {
                Debug.LogError("PlayerController.jumpForce is deprecated. Use jumpHeight instead.");
                jumpHeight = jumpForce;
            }
            if (jumpDownwardForce != 0 && gravity == 0) {
                Debug.LogError("PlayerController.jumpDownwardForce is deprecated. Use gravity instead.");
                gravity = jumpDownwardForce;
            }
            // rigidbody should no longer use gravity, be kinematic, and freeze all constraints
            Rigidbody playerRigibody = GetComponent<Rigidbody>();
            if (playerRigibody != null) {
                if (playerRigibody.useGravity) {
                    Debug.LogError("The rigidbody no longer needs to use gravity. Disabling.");
                    playerRigibody.useGravity = false;
                }
                if (!playerRigibody.isKinematic) {
                    Debug.LogError("The rigidbody should be kinematic. Enabling.");
                    playerRigibody.isKinematic = true;
                }
                if (playerRigibody.constraints != RigidbodyConstraints.FreezeAll) {
                    Debug.LogError("The rigidbody should freeze all constraints. The PlayerController will take care of the physics.");
                    playerRigibody.constraints = RigidbodyConstraints.FreezeAll;
                }
            }

            cameraController = CameraController.instance;
            infiniteObjectGenerator = InfiniteObjectGenerator.instance;
            powerUpManager = PowerUpManager.instance;
            gameManager = GameManager.instance;
            if (attackType == AttackType.Projectile) {
                projectileManager = GetComponent<ProjectileManager>();
            }

            platformLayer = 1 << LayerMask.NameToLayer("Platform");
            floorLayer = 1 << LayerMask.NameToLayer("Floor");
            wallLayer = 1 << LayerMask.NameToLayer("Wall");
            obstacleLayer = 1 << LayerMask.NameToLayer("Obstacle");

            thisTransform = transform;
            capsuleCollider = GetComponent<CapsuleCollider>();
            playerAnimation = GetComponent<PlayerAnimation>();
            playerAnimation.Init();

            startPosition = thisTransform.position;
            startRotation = thisTransform.rotation;

            slideData = new CoroutineData();
            stumbleData = new CoroutineData();
            forwardSpeeds.Init();
            // determine the fastest and the slowest forward speeds
            forwardSpeeds.GetMinMaxValue(out minForwardSpeed, out maxForwardSpeed);
            forwardSpeedDelta = maxForwardSpeed - minForwardSpeed;
            if (forwardSpeedDelta == 0) {
                playerAnimation.SetRunSpeed(1, 1);
            }

            ResetValues(false);
            enabled = false;
        }