예제 #1
0
	void Awake() 
	{
		GameObject comboObjPool = GameObject.Find("/_UIStuff/SingleComboPool");
		if(comboObjPool != null)
			singleComboPool = comboObjPool.GetComponent<ObjectPool>();
		else
			Debug.LogError("Cannot find Single Combo Object Pool");

		keyComboContainer = transform.Find("ComboPanel").gameObject;
		if(keyComboContainer == null)
			Debug.LogError("Cannot find Score Bar Object");

		keyMap = GameObject.FindGameObjectWithTag("GameManager").GetComponent<Keymap>();

        if (player == 0)
            playerCombo = GameObject.FindWithTag("Player1").GetComponent<SpiderCombo>();
        else
            playerCombo = GameObject.FindWithTag("Player2").GetComponent<SpiderCombo>();
    }
예제 #2
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;
	}
예제 #3
0
	public bool isSequenceOK(SpiderCombo spiderCombo, float minDeltaT, GameObject player) {
		// CONTROLLI INIZIALI
		if (buttonTimeList.Count < spiderCombo.buttonsList.Count) // Se non ho fatto abbastanza mosse
			return false;
		if (!spiderCombo.spider.isDown) // Se il ragno non è girato
			return false;
		if (Vector3.Distance (player.transform.position, spiderCombo.spider.transform.position) > spiderCombo.spider.radiusForAttack) // Se non sono vicino al ragno
			return false;
        if (!player.GetComponent<InputManager>().isLegalHit(spiderCombo.spider.side)) // Se cerco di combare sul lato sbagliato della mappa
            return false;
		
		bool isOK = true;
		for (int i = 0; i < spiderCombo.buttonsList.Count; i++) {
			if (buttonTimeList [i].button != spiderCombo.buttonsList [spiderCombo.buttonsList.Count - 1 - i]) {
				isOK = false;
			}
		}
			
		if ((Time.realtimeSinceStartup - buttonTimeList [spiderCombo.buttonsList.Count - 1].timeFromStart) > minDeltaT) {
			isOK = false;
		}

		return isOK;
	}