Ejemplo n.º 1
0
	void Start () {
		//Time.timeScale = 1;
		Map.Initialize ();
		timer = 0;
		waveTime = 0;

		ApplicationModel.currentEnemyNum = 0;

		myAudio = GetComponent<AudioSource>();
		PlaySound(GAME_MUSIC);
	
		level = ApplicationModel.GetCurrentLevel();	
		
		wave = GetComponent<WaveController>();
		wave.ReadFile(level.ID);
		next = wave.Next ();
		initWarning ();
		player = playerObject.GetComponent<Player>();
		
		
		level.Start();
		Debug.Log( "This level has been started "+level.GetTimesStarted()+" times.");
		Debug.Log( "This level has been played "+level.GetTimesPlayed()+" times.");

		fadeEffect = fader.GetComponent<FadeEffect> ();
		fadeEffect.FadeIn ();
		gameStartPlayed = false;

	}
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        Destroy (this.gameObject, 9f);
        player = CustomExtensions.GetPlayer ();
        rb = GetComponent<Rigidbody> ();

        GameObject gameController = GameObject.FindGameObjectWithTag ("GameController");
        waveScript = gameController.GetComponent<WaveController> ();
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     mRigidbody       = this.GetComponent <Rigidbody2D>();
     mWaveCollider    = GameObject.FindGameObjectWithTag("waveCollider");
     mWaveController  = mWaveCollider.GetComponent <WaveController>();
     isCastingWave    = false;
     distanceToGround = this.GetComponent <BoxCollider2D>().bounds.max.y - mRigidbody.transform.position.y;
     mAnimator        = this.GetComponent <Animator>();
     //mMusicManager = GameObject.FindGameObjectWithTag("musicManager").GetComponent<MusicManager>();
 }
Ejemplo n.º 4
0
    private void Start()
    {
        waveController = GameObject.FindObjectOfType <WaveController>();

        leftDoorOpenPosition  = leftDoor.transform.position;
        rightDoorOpenPosition = rightDoor.transform.position;

        leftDoorClosedPosition  = new Vector3(leftDoorOpenPosition.x, leftDoorOpenPosition.y, leftDoorOpenPosition.z + 2);
        rightDoorClosedPosition = new Vector3(rightDoorOpenPosition.x, rightDoorOpenPosition.y, rightDoorOpenPosition.z - 2);
    }
    /// <summary>
    /// Runs once when the script has been initialized.
    /// </summary>
    private void Start()
    {
        _myRigidBody = GetComponent <Rigidbody2D>();
        _cam         = Camera.main;

        _waveController = FindObjectOfType <WaveController>();
        _waveController.SetHealthbar(maxHealth);

        _myCombatController.SetMaxHealth(maxHealth);
    }
Ejemplo n.º 6
0
	void Start() {
		//Get the water mesh
		waterMesh = this.GetComponent<MeshFilter>().mesh;

		originalVertices = waterMesh.vertices;

		//Get the waveScript
		GameObject gameController = GameObject.FindGameObjectWithTag("GameController");

		waveScript = gameController.GetComponent<WaveController>();
	}
Ejemplo n.º 7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 8
0
    internal void Initialize()
    {
        _text           = GameObject.Find("Wave Text").GetComponent <Text>();
        _icon           = GameObject.Find("Icon").GetComponent <Image>();
        _wave           = FindObjectOfType <WaveController>();
        _phaseDurations = _wave.GetPhaseDurations();

        _textNext = GameObject.Find("Wave Text 2").GetComponent <Text>();
        _iconNext = GameObject.Find("Icon 2").GetComponent <Image>();

        GameObject.Find("Container").GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width, 120);
    }
Ejemplo n.º 9
0
    void Awake()
    {
        waves            = FindObjectOfType <WaveController>();
        pc               = GetComponent <PlayerCombat>();
        anim             = GetComponent <Animator>();
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        tBases.text   = bases.ToString();
        tCredits.text = credits.ToString();

        // Get turret names and total turret count
        string[] turretNames = Enum.GetNames(typeof(Tool)).Skip(1).ToArray();
        int      types       = turretNames.Length;

        // Sets each turret cost
        costs = new Dictionary <string, int>(types);
        costs[Tool.Base.ToString()]    = 1;
        costs[Tool.Blaster.ToString()] = 300;
        costs[Tool.Tumper.ToString()]  = 500;
        costs[Tool.Laser.ToString()]   = 2000;

        // Initializes the prefabs Dictionary
        prefabs = new Dictionary <string, GameObject>(types);
        // Gets references to the placeholder objects
        placeHolders = new Dictionary <string, GameObject>(types);
        phRenderers  = new Dictionary <string, List <MeshRenderer> >(types);
        defMaterial  = Resources.Load <Material>("Materials/Placeholder/Default");
        invMaterial  = Resources.Load <Material>("Materials/Placeholder/Invalid");
        Transform phParent = GameObject.Find("Placeholders").transform;
        string    name;

        for (int i = 0; i < types; i++)
        {
            name = turretNames[i];
            placeHolders[name] = phParent.FindChild(name).gameObject;
            placeHolders[name].SetActive(false);
            prefabs[name]     = Resources.Load <GameObject>("Prefabs/Buildables/" + name);
            phRenderers[name] = placeHolders[name].GetComponentsInChildren <MeshRenderer>().ToList();
            phRenderers[name].RemoveAll(HasDetail);
            phRenderers[name].TrimExcess();
        }

        // Set initial tool
        ph = placeHolders[tool.ToString()];

        // Set properties for raycasting
        cam         = Camera.main;
        screenPoint = new Vector3(Screen.width / 2, Screen.height / 2, MAX_RANGE);
        floorLayer  = LayerMask.NameToLayer("Floor");
        baseLayer   = LayerMask.NameToLayer("Base");
        turretLayer = LayerMask.NameToLayer("Turret");
    }
 public void ChangeHealth()
 {
     //public method that player weapons can call to damage this.
     enemyHealth -= PlayerStats.playerDamage;
     if (enemyHealth <= 0)
     {
         //DropLoot();
         WaveController.DropLoot(enemyDifficulty, rb.position);
         WaveController.enemiesRemaining--;
         Destroy(gameObject);
     }
 }
Ejemplo n.º 11
0
    void Start()
    {
        MultiplayerSceneProperties.Instance.currentPlayerList  = new List <byte>();
        MultiplayerSceneProperties.Instance.previousPlayerList = new List <byte>();

        GameObject waveControllerOBJ = GameObject.Find("WaveController");

        if (waveControllerOBJ != null)
        {
            waveController = waveControllerOBJ.GetComponent <WaveController>();
        }
    }
Ejemplo n.º 12
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         // DontDestroyOnLoad(gameObject); // unless we want to keep track of zombies from before.
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 13
0
    void Awake()
    {
        _audioSource      = GetComponent <AudioSource>();
        _cameraScreenSize = Camera.main.orthographicSize;
        _cameraZoom       = GetComponent <ProCamera2DSpeedBasedZoom>();
        _waveController   = GetComponent <WaveController>();

        EnemyDied.AddListener(OnEnemyDeath);
        WaveCompleted.AddListener(OnWaveCompleted);

        SceneManager.sceneLoaded += OnSceneLoaded;
    }
Ejemplo n.º 14
0
        private void Start()
        {
            //Start paused
            GameLogic.IsPaused = this.startPaused;

            //Set important stuff
            this.uiAnimator.SetFloat("BossSpeed", this.bossUISpeed);
            this.uiAnimator.SetFloat("EndSpeed", this.endUISpeed);
            this.background.StartMovement(AccelerationMovement.MovementMode.APPROACH);
            this.asteroidController = Instantiate(this.asteroids).GetComponent <AsteroidWaveController>();
            this.asteroidController.StartWave();
            StartRandomController();
        }
Ejemplo n.º 15
0
	void Awake(){
		if(GameController.Instance != null){
			DestroyImmediate(gameObject);
			return;
		}
		_instance = this;
		
		SpawnPlayer();
		
		cycle = GameObject.Find("Sun").GetComponent<DayNightCycle>();
		waveController = GameObject.Find("WaveController").GetComponent<WaveController>();
		ship = GameObject.FindWithTag(Globals.SHIP).transform;
	}
Ejemplo n.º 16
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();

        player         = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
        waveController = GetComponent <WaveController>();

        //エンディング初期化
        if (PlayerPrefs.HasKey(endingPrefsKey))
        {
            PlayerPrefs.DeleteKey(endingPrefsKey);
        }
    }
Ejemplo n.º 17
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.name != "WaveController")
     {
         return;
     }
     if (_started == false)
     {
         _started        = true;
         _waveController = other.GetComponent <WaveController>();
         _waveController.WaveRespawn(ufoWave);
     }
 }
Ejemplo n.º 18
0
    // Finds all alive enemy game objects from wave controller's spawners
    List <GameObject> FindAllEnemies(WaveController controller)
    {
        List <GameObject> enemies = new List <GameObject>();

        foreach (EnemySpawner spawner in controller.spawners)
        {
            foreach (Transform child in spawner.transform)
            {
                enemies.Add(child.gameObject);
            }
        }

        return(enemies);
    }
Ejemplo n.º 19
0
    private void Start()
    {
        _events             = FindObjectOfType <EventsController>();
        _waveController     = FindObjectOfType <WaveController>();
        _currencyController = FindObjectOfType <CurrencyController>();
        _attackerSpawners   = FindObjectsOfType <AttackerSpawner>();
        _heatZones          = FindObjectOfType <HeatZones>();
        _infoController     = FindObjectOfType <InfoController>();
        _boardEvents        = FindObjectOfType <BoardEvents>();

        _cooldownCounterReset();

        StartCoroutine(_firstEvent());
    }
Ejemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        waveController = GameObject.FindWithTag("wavecontroller").GetComponent <WaveController>();

        target = FindClosestTag("Player", gameObject, true);
        if (target == null)
        {
            target = FindClosestTag("Player", gameObject);
        }


        Invoke("EvaluateTarget", evaluationTime);
        Invoke("RandomRunAnimation", animationRandomizerTimer);
    }
    void Start()
    {
        //Get the controllerScripts
        GameObject gameController = GameObject.FindGameObjectWithTag("GameController");

        waveScript  = gameController.GetComponent <WaveController>();
        worldScript = gameController.GetComponent <WorldController> ();

        //Get the water mesh
        waterMesh = this.GetComponent <MeshFilter>().mesh;
        GenerateWaterMesh.GenerateWater(this.GetComponent <MeshFilter>(), worldScript.width, 0.5f, 0.0f);
        waterMesh = this.GetComponent <MeshFilter>().mesh;

        originalVertices = waterMesh.vertices;
    }
Ejemplo n.º 22
0
    public static void SaveWaves(WaveController controller)
    {
        //BinaryFormatter formatter = new BinaryFormatter();

        string path = Application.dataPath + "/Resources/Waves.json";
        //FileStream stream = new FileStream(path, FileMode.Create);

        WaveData data = new WaveData(controller);

        string jsonData = JsonUtility.ToJson(data);

        //formatter.Serialize(stream, data);
        //stream.Close();
        File.WriteAllText(path, jsonData);
    }
Ejemplo n.º 23
0
    public void destroy()
    {
        destroyed                 = true;
        EventControl.killUnit    -= onUnitKilled;
        EventControl.lifeChanged -= onLifeChanged;

        for (int i = 0; i < waves.Length; i++)
        {
            WaveController wave = waves[i];
            if (wave)
            {
                wave.destroy();
            }
        }
    }
    void Start()
    {
        BoatMesh       = GetComponent <MeshFilter>().mesh;
        UnderWaterMesh = UnderwaterMeshOBJ.GetComponent <MeshFilter>().mesh;

        originalVerticesArray  = BoatMesh.vertices;
        originalTrianglesArray = BoatMesh.triangles;

        boatRB = GetComponent <Rigidbody>();
        boatRB.maxAngularVelocity = 0.5f;

        GameObject gameController = GameObject.FindGameObjectWithTag("GameController");

        waveScript  = gameController.GetComponent <WaveController>();
        waterScript = GameObject.FindGameObjectWithTag("Water").GetComponent <WaterController>();
    }
Ejemplo n.º 25
0
    /// <summary>
    /// 根据 PaperData 的位置和高宽信息构造一个纸片
    /// </summary>
    /// <param name="paperData"> 至少包含纸片位置和高宽信息的纸片数据 </param>
    /// <returns> 返回新纸片对应的 WaveController脚本 </returns>
    /// <remarks> 纸片的 waveData 请之后单独设置 </remarks>
    private WaveController GetPaper(PaperData paperData)
    {
        // 实例化纸片
        Transform paperTransform = Instantiate(PaperPrefab, papersParentTransform).transform;

        paperTransform.localPosition = paperData.localPosition;
        //保存 WaveController
        WaveController waveController = paperTransform.GetComponent <WaveController>();

        // 设置纸片宽和高
        waveController.PaperWeight = paperData.paperWeight;
        waveController.PaperHeight = paperData.paperHeight;

        // 返回生成纸片的 WaveController脚本
        return(waveController);
    }
Ejemplo n.º 26
0
        //checks wether or not the user have pressed escape and if they have call all the neccessary reset methods to go back to the main menu.
        public void MapUpdate()
        {
            KeyboardState keyboardState = Keyboard.GetState();

            if (keyboardState.IsKeyDown(Keys.Escape))
            {
                SceneController.CurrentState = SceneController.State.Menu;
                Game1.MapHasBeenSelected     = false;
                Game1.HasBeenCalled          = false;
                Game1.InteractableMenu.Reset();
                WaveController.Reset();
                TowerController.Reset();
                PlayerController.Reset();
                Game1.HelpMenuActive = true;
            }
        }
Ejemplo n.º 27
0
    /// <summary> 初始化用户修改纸片的关卡 </summary>
    private void InitializeModifyLevel()
    {
        // 关卡数据
        LevelData levelData = DataController.Instance.GetCurrentLevelData();

        // 纸片们数据
        PaperData[] papersData = levelData.papersData;
        // 用户可操作纸片的数据们
        WaveData[] waveDatas = new WaveData[2];
        // 所有纸片的 WaveController们
        WaveController[] waveControllers =
            new WaveController[levelData.papersData.Length];

        // 生成纸片们,尚未给予 WaveData
        {
            int i = 0;
            foreach (PaperData paperData in papersData)
            {
                waveControllers[i++] = GetPaper(paperData);
            }
        }

        // 配置两张基础纸片的 WaveData
        for (int i = 0; i < 2; ++i)
        {
            waveControllers[i].WaveData = waveDatas[i] =
                new WaveData(papersData[i].waveAttributes);
        }

        // 配置 和视图纸片 的 WaveData
        // 注: 和视图纸片 不能被用户直接修改
        //     但会自动立即反应其下 加数纸片 的修改
        //     即创建自己的 waveDataMasks,记录别人的 WaveDataMask们
        WaveData sum = waveControllers[2].WaveData = new WaveData(waveDatas);

        // 配置目标纸片的 WaveData
        // 注:目标纸片 初始化的结果为最原始的 和视图纸片 叠加一个 目标修改
        //             且初始化后不能被修改
        //     即:如果关卡只修改 用户可操作纸片们的WaveModification
        //            则至少对和纸片的拷贝级别应该达到 拷贝每个WaveModification
        WaveData goal = new WaveData(sum);

        // 对目标纸片的第一个蒙版做目标修改
        // 注:因为用户只操作一个纸片,故只需要对一个 Mask 做修改,约定为第一个
        goal.ModifyByMask(0, levelData.modification);
        waveControllers[3].WaveData = goal;
    }
Ejemplo n.º 28
0
    void Awake()
    {
        getOriginalColors();

        waveController            = GameObject.FindObjectOfType <WaveController> ();
        scoreController           = GameObject.FindObjectOfType <GameController> ();
        this.enemy                = this.GetComponent <CharacterController> ();
        this.enemyAnimation       = this.GetComponent <Animator> ();
        this.enemyAnimation.speed = enemyAnimationSpeed;

        if (enemyType == "Soldier")
        {
            enemyWeapon = this.GetComponent <FireEnemyWeapon> ();
        }

        modEnemyStats();
    }
Ejemplo n.º 29
0
    // 根据屏幕坐标寻找要修改的纸片的 WaveModification 和 WaveController
    private bool FindWaveRefByScreenPos(
        Vector2 screenPointOne,
        Vector2?screenPointTwo = null
        )
    {
        // 将 屏幕坐标 转换到 世界坐标
        Vector2 worldPoint = mainCamera.ScreenToWorldPoint(new Vector3(
                                                               screenPointOne.x,
                                                               screenPointOne.y
                                                               ));

        // 如果坐标落在某个 可修改纸片的内部
        for (int i = 0; i < 2; ++i)
        {
            if (inBound(worldPoint, i))
            {
                // 如果传入了第二个点
                if (screenPointTwo != null)
                {
                    // 将 屏幕坐标 转换到 世界坐标
                    worldPoint = mainCamera.ScreenToWorldPoint(new Vector3(
                                                                   screenPointOne.x,
                                                                   screenPointOne.y
                                                                   ));
                    // 如果第二个点不在第i张纸片上,返回 false,并且不更新引用们
                    if (!inBound(worldPoint, i))
                    {
                        return(false);
                    }
                }

                // 记录用户要更改的 WaveModification
                waveModification = waveModifications[i];
                waveModificationOrigin.CopyFrom(waveModification);
                // 记录要应用更改的 WaveData 和 WaveController
                waveData       = waveDatas[i];
                waveController = waveControllers[i];

                // 返回 true:已找到
                return(true);
            }
        }

        // 否则返回 false:未找到
        return(false);
    }
Ejemplo n.º 30
0
    // Use this for initialization
    void Awake()
    {
        free = true;
        isProtectedByShield = false;
        speed  = 600.0f;
        player = GameObject.FindGameObjectWithTag("Player");
        rb2d   = GetComponent <Rigidbody2D>();
        body   = transform.GetChild(0).gameObject;

        arenaRadius = GameObject.FindGameObjectWithTag("Walls").GetComponent <WallsController>().getRadius();

        cloudRadius    = 8f;
        cloudDecayTime = 5f;
        bloaterRadius  = 0.8f;
        anim           = body.GetComponent <Animator>();
        waveController = GameObject.FindGameObjectWithTag("Wave Manager").GetComponent <WaveController>();
    }
Ejemplo n.º 31
0
    // Use this for initialization
    public void Initialize()
    {
        START  = new Phase("Start");
        READY  = new Phase("Ready");
        BATTLE = new Phase("Battle");
        END    = new Phase("End");

        nowPhase = START;

        waveController = GetComponent <WaveController>();

        timeCounter = 0f;
        totalTime   = 0f;

        players = GameObject.FindGameObjectsWithTag("Player");
        //Start ();
    }
Ejemplo n.º 32
0
    private void BeginSpawning()
    {
        Debug.Log("Starting new wave");

        currentWave = waveSpawner.transform.GetChild(wave).
                      gameObject.GetComponent <WaveController>();
        if (currentWave)
        {
            numEnemies = currentWave.numEnemies;
            SpawnWave(numEnemies);
        }
        else
        {
            Debug.Log("No more waves found, game ending.");
            EventManager.TriggerEvent(EventNames.GAME_WON);
        }
    }
Ejemplo n.º 33
0
    public void StartWave(WaveController wave, int waveNum)
    {
        // Spawn amount based on wave number
        if (GameController.Instance.EndWave() > 0)
        {
            if (waveNum == GameController.Instance.CurWave() + GameController.Instance.EndWave())
            {
                GameController.Instance.SpawnRescueShip();
            }
        }

        UIManager.Instance.uiState = UIManager.UIState.NONE;
        controller = wave;
        waveNumber = waveNum;
        beginWave  = false;
        StartCoroutine("WaveHandling");
    }
Ejemplo n.º 34
0
    void Awake()
    {
        if (target1 == null) {
            target1 = GameObject.FindGameObjectWithTag ("Player").GetComponent<Transform> ();
        }

        waveheight = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WaveController> ();
        Vector3 angles = transform.eulerAngles;
        xDeg = angles.x;
        yDeg = angles.y;
        currentDistance = 	distance;
        desiredDistance = distance;
        correctedDistance = distance;

        // Make the rigid body not change rotation
        if (GetComponent<Rigidbody>())
            GetComponent<Rigidbody>().freezeRotation = true;
    }
Ejemplo n.º 35
0
 public WaveEvent(int waveNumber)
 {
     waveController = GameObject.Find(" GameController").GetComponentInChildren<WaveController>();
     waveFlag = waveNumber;
 }
Ejemplo n.º 36
0
 void Awake()
 {
     i = this;
 }
Ejemplo n.º 37
0
 // Use this for initialization
 void Start()
 {
     waveController = GetComponent<WaveController>();
 }
Ejemplo n.º 38
0
    void Start()
    {
        //waterWakes = GameObject.FindGameObjectWithTag ("Water").GetComponent<WaterV3> ();

        GameObject gameController = GameObject.FindGameObjectWithTag ("GameController");
        waveScript = gameController.GetComponent<WaveController> ();

        UnderWaterMesh = underWaterMeshObj.GetComponent<MeshFilter> ().mesh;
        BoatMesh = GetComponent<MeshFilter> ().mesh;

        originalVerticesArray = BoatMesh.vertices;
        originalTrianglesArray = BoatMesh.triangles;

        boatRB = GetComponent<Rigidbody> ();

        boatRB.maxAngularVelocity = 0.5f;
    }
Ejemplo n.º 39
0
    void Start()
    {
        //		Debug.Log("terrain width = " + terrainWidth.ToString());
        //		Debug.Log("terrain height = " + terrainHeight.ToString());

        minimapCam = GameObject.Find("Minimap Camera").GetComponent<Camera>();
        firstPersonCam = GameObject.Find("Main Camera").GetComponent<Camera>();
        //set default skybox
        DEFAULT_SKYBOX = Resources.Load("Skyboxes/Skybox18", typeof(Material)) as Material;
        GameObject.Find("Main Camera").GetComponent<Skybox>().material = DEFAULT_SKYBOX;
        GameObject.Find("Minimap Camera").GetComponent<Skybox>().material = DEFAULT_SKYBOX;
        // Controller Inits
        _game = GameObject.Find(" GameController").GetComponent<GameController>();
        _level = _game.gameObject.GetComponent<LevelController>();
        _player = GameObject.Find("Player").GetComponent<PlayerController>();
        _weapon = _player.gameObject.GetComponentInChildren<WeaponController>();
        _wave = GameObject.Find(" GameController").GetComponent<WaveController>();

        // Path Drawer
        pathDrawer = Resources.Load("Prefabs/Tools/PathDrawer", typeof(GameObject)) as GameObject;

        firstPersonCam.enabled = true;
        minimapCam.enabled = false;
    }
Ejemplo n.º 40
0
    void Start()
    {
        Gridsourceimage = new Texture2D (256 , 256);
        //Gridsourceimage.Apply();

        //Gridsourceimage = //Resources.Load("Textures/Water", typeof(Texture2D)) as Texture2D;
        waveScript = GameObject.FindGameObjectWithTag ("GameController").GetComponent<WaveController> ();

        watertileLoad =  Resources.Load("Mesh/WaterV6", typeof(GameObject)) as GameObject;

        meshWidth = (watertileLoad.GetComponent<MeshFilter>().sharedMesh.bounds.size.x * watertileLoad.transform.lossyScale.x);

        player = CustomExtensions.GetPlayer();

        //waterSize = GetComponentInChildren<WaterV3> ();
        //TileCheck ();

        CreateGrid();

        Debug.Log(WaterVectorList.Count);
    }
 void Awake()
 {
     cam = this;
 }
Ejemplo n.º 42
0
 public void Start()
 {
     Instance = this;
 }
Ejemplo n.º 43
0
    void Awake()
    {
        Singleton = this;

        GameStateManager.GameStateChanged += this.GameStateChangedHandler;
    }
Ejemplo n.º 44
0
 public void OnDestroy()
 {
     Instance = null;
 }
Ejemplo n.º 45
0
    void Awake()
    {
        if (I == null){
            I = this;
        }else{
            Destroy(gameObject);
            return;
        }

        camCtrl = GetComponent<CameraController>();
        waveCtrl = GetComponent<WaveController>();
        uiCtrl = GetComponent<UIController>();
        buildingCtrl = GetComponent<BuildingController>();
        partCtrl = GetComponent<ParticleController>();
        audioCtrl = GetComponent<AudioController>();

        foreach (ProjectileType typ in System.Enum.GetValues(typeof(ProjectileType))) {
            turretAmmo[typ] = -1;
            turretReloadTimers[typ] = 0;
        }
    }
Ejemplo n.º 46
0
    void Start()
    {
        Debug.Log("START: " + footstepInterval);

        _game = GameObject.Find(" GameController").GetComponent<GameController>();
        _wave = GameObject.Find(" GameController").GetComponent<WaveController>();
        _weapon = GetComponentInChildren<WeaponController>();
        _overviewCamera = GameObject.Find("Minimap Camera").GetComponent<CameraController>();

        Screen.showCursor = true;

        Texture2D left = Resources.Load("Textures/Weapon/TakeDamage0", typeof(Texture2D)) as Texture2D;
        Texture2D right = Resources.Load("Textures/Weapon/TakeDamage1", typeof(Texture2D)) as Texture2D;
        Color c = new Color(0.8f, 0, 0, 1f);
        leftDamage = new MyTexture2D(left,
            new Rect((Screen.width / 2) - left.width, (Screen.height - left.height) / 2, left.width, left.height), c);
        rightDamage = new MyTexture2D(right,
             new Rect(Screen.width / 2, (Screen.height - right.height) / 2, right.width, right.height), c);

        // Player Variables
        _life = MAX_LIFE;

        AudioSource[] a = GetComponents<AudioSource>();
        footstepsAudio = a[0];
        footstepsAudio.volume = 0.25f;
        jumpingAudio = a[1];
        voiceAudio = a[2];

        _motor = GetComponent<CharacterMotor>();
        //		footsteps = new AudioClip[1];
        //		footsteps[0] = Resources.Load("Sound/Player/jump") as AudioClip;
        footsteps = new AudioClip[3];
        footsteps[0] = Resources.Load("Sound/Player/foot_1") as AudioClip;
        footsteps[1] = Resources.Load("Sound/Player/foot_2") as AudioClip;
        footsteps[2] = Resources.Load("Sound/Player/foot_3") as AudioClip;
        onJumpAudio = Resources.Load("Sound/Player/Lilith_jump") as AudioClip;
        onLandAudio = Resources.Load("Sound/Player/Lilith_land") as AudioClip;
        onOutOfAmmo = Resources.Load("Sound/Player/Lilith_outofammo") as AudioClip;
    }