// Use this for initialization void Start() { // get references to required classes GameObject mapTransitionerCtrl = GameObject.Find("MapTransition Ctrl"); mapTransitioner = (MapTransitioner)mapTransitionerCtrl.GetComponent(typeof(MapTransitioner)); GameObject procGenCtrl = GameObject.Find("ProcGen Ctrl"); procGen = (ProcGen)procGenCtrl.GetComponent(typeof(ProcGen)); playerObject = GameObject.Find("Player"); playerObject.SetActive(false); // Run level generation // MapTile[,] mapArray = procGen.createLevel(80, 60, 0.60f); // transition level on // register an action handler for when the level // becomes available mapTransitioner.LevelAvailable += delegate { placePlayerOnStart(); }; // mapTransitioner.StartTransitioning(mapArray); // run a demo to transition the level every few seconds // StartCoroutine( levelTransitionDemo() ); levelDemo(); }
public override void OnSet(Chunk chunk, int x, int y, bool bossRoom = false) { if (Random.Range(0, 2) == 0) { TextAsset obstacle = ProcGen.GetRandomObstacle(); chunk.SetObstacleBlock(x, y, obstacle.text); } else { chunk.SetTile(x, y, TileType.Wall); } }
void Start() { _gameManager = GameManager.instance; if (_gameManager != null) { foreach (UpgradeStruct us in _gameManager._allUpgrades) { if (us.upgradeValues[0].upgradeType == UpgradeType.ParrotUpgrade) { if (us.Purchased) { _parrotActive = true; } break; } } } anim = GetComponentInChildren <Animator>(); baseAnimSpeed = anim.speed; mainCamera = FindObjectOfType <SmoothCam>(); // Effects Vector3 offset = transform.up * 2 + transform.forward * 0.35f; GameObject drunkObj = (GameObject)Instantiate(drunkEffect, transform.position + offset, transform.rotation); drunkObj.transform.parent = transform; drunkParticles = drunkObj.GetComponent <ParticleSystem>(); GameObject soberObj = (GameObject)Instantiate(soberEffect, transform.position + offset, transform.rotation); soberObj.transform.parent = transform; soberParticles = soberObj.GetComponent <ParticleSystem>(); ragdoll = GetComponentInChildren <PirateCharacterAnimator>(); sceneManager = SceneManager_Andrew.instance; startingRotation = transform.rotation; startingPosition = transform.position; controller = GetComponent <CharacterController>(); lg = GameObject.FindGameObjectWithTag("LevelGen").GetComponent <ProcGen>(); //debugText = GameObject.Find("DEBUG").GetComponent<Text>(); // Quick and dirty debugging jumpSound = (AudioClip)Resources.Load("Sounds/player_jump"); splashSound = (AudioClip)Resources.Load("Sounds/player_splash"); smackSound = (AudioClip)Resources.Load("Sounds/player_smack"); deckSound = (AudioClip)Resources.Load("Sounds/deck_jump"); landSound = (AudioClip)Resources.Load("Sounds/player_land"); skidSound = (AudioClip)Resources.Load("Sounds/player_skid"); ResetCharacter(); }
void Start() { _gameManager = GameManager.instance; if(_gameManager != null) { foreach (UpgradeStruct us in _gameManager._allUpgrades) { if (us.upgradeValues[0].upgradeType == UpgradeType.ParrotUpgrade) { if (us.Purchased) { _parrotActive = true; } break; } } } anim = GetComponentInChildren<Animator>(); baseAnimSpeed = anim.speed; mainCamera = FindObjectOfType<SmoothCam>(); // Effects Vector3 offset = transform.up * 2 + transform.forward * 0.35f; GameObject drunkObj = (GameObject)Instantiate(drunkEffect, transform.position + offset, transform.rotation); drunkObj.transform.parent = transform; drunkParticles = drunkObj.GetComponent<ParticleSystem>(); GameObject soberObj = (GameObject)Instantiate(soberEffect, transform.position + offset, transform.rotation); soberObj.transform.parent = transform; soberParticles = soberObj.GetComponent<ParticleSystem>(); ragdoll = GetComponentInChildren<PirateCharacterAnimator>(); sceneManager = SceneManager_Andrew.instance; startingRotation = transform.rotation; startingPosition = transform.position; controller = GetComponent<CharacterController>(); lg = GameObject.FindGameObjectWithTag("LevelGen").GetComponent<ProcGen>(); //debugText = GameObject.Find("DEBUG").GetComponent<Text>(); // Quick and dirty debugging jumpSound = (AudioClip)Resources.Load("Sounds/player_jump"); splashSound = (AudioClip)Resources.Load("Sounds/player_splash"); smackSound = (AudioClip)Resources.Load("Sounds/player_smack"); deckSound = (AudioClip)Resources.Load("Sounds/deck_jump"); landSound = (AudioClip)Resources.Load("Sounds/player_land"); skidSound = (AudioClip)Resources.Load("Sounds/player_skid"); ResetCharacter(); }
void Awake() { Instance = this; }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player> (); pG = GameObject.FindGameObjectWithTag("LevelGen").GetComponent <ProcGen> (); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); pG = GameObject.FindGameObjectWithTag ("LevelGen").GetComponent<ProcGen> (); }