示例#1
0
文件: Spider.cs 项目: Tb95/GGJ2016
	// Use this for initialization
	void Start () {
        comboTextPlayer1 = spawner.comboTextPlayer1;
        comboTextPlayer2 = spawner.comboTextPlayer2;
		spiderTrail = spawner.spiderTrail;
		
		var players = GameObject.FindGameObjectsWithTag("Player");
        player = players[Random.Range(0, players.Length)];

		side = InputManager.getRandomSide ();
        switch (side)
        {
            case InputManager.Side.Left:
                foreach (var item in GetComponentsInChildren<Renderer>())
                {
                    item.sharedMaterial = darkMaterial;
                }
                break;

            case InputManager.Side.Right:
                foreach (var item in GetComponentsInChildren<Renderer>())
                {
                    item.sharedMaterial = lightMaterial;
                }
                break;
        }

		buttonsManager = GameObject.FindGameObjectWithTag ("ButtonsManager").GetComponent<ButtonsManager>();
		comboList = buttonsManager.getRandomCombo(comboLength, side);
		spiderCombo = new SpiderCombo (comboList, this);
		InputManager.possibleSpiderCombos.Add(spiderCombo);

        animator = GetComponent<Animator>();

		// Play fall sound
		gameObject.GetComponent<AudioSource>().clip = spiderFall;
        gameObject.GetComponent<AudioSource>().PlayScheduled(AudioSettings.dspTime + 1.0);

        myMovement = movement;
	}