Exemplo n.º 1
0
    private void UpdateCharacterCharge()
    {
        Color newChargeColor = neutralColor;

        switch (characterCharge)
        {
        case CharacterCharge.Positive:
            newChargeColor = positiveColor;
            break;

        case CharacterCharge.Negative:
            newChargeColor = negativeColor;
            break;
        }

        for (int rendererIdx = 0; rendererIdx < chargeRenderers.Length; ++rendererIdx)
        {
            Renderer chargeRenderer             = chargeRenderers[rendererIdx];
            MaterialPropertyBlock propertyBlock = _propertyBlocks[rendererIdx];

            chargeRenderer.GetPropertyBlock(propertyBlock);
            propertyBlock.SetColor(MATERIAL_CHARGE_COLOR_PROPERTY, newChargeColor);
            chargeRenderer.SetPropertyBlock(propertyBlock);
        }

        _currentCharge = characterCharge;
    }
Exemplo n.º 2
0
    private void SpawnCharacterInRandomRoom()
    {
        if (_hasStoppedSpawning)
        {
            return;
        }

        CharacterType characterType    = _characterHand.GetRandomElement();
        int           characterTypeIdx = (int)characterType;

        if (characterTypeIdx >= visitorPrefabs.Length)
        {
            Debug.LogError("Trying to spawn character of type (" + characterType.ToString() + ") but no prefab has been defined for it.");
            return;
        }

        int roomIndex = _roomHand.GetRandomElement();

        if (roomIndex >= spawnPositions.Length)
        {
            Debug.LogError("Trying to spawn character of type (" + characterType.ToString() + ") in room (" + roomIndex.ToString() + ") but the room doesn't exist.");
            return;
        }

        CharacterCharge characterCharge = CharacterCharge.Neutral;

        if (_hasSplitted)
        {
            characterCharge = _chargeHand.GetRandomElement();
        }

        Room       room        = spawnPositions[roomIndex].room;
        GameObject characterGO = Instantiate(visitorPrefabs[characterTypeIdx], visitorParent);
        Character  character   = characterGO.GetComponent <Character>();

        character.characterCharge = characterCharge;

        Vector3 characterPosition = spawnPositions[roomIndex].positionHand.GetRandomElement().position;

        characterPosition.z            = characterGO.transform.position.z;
        characterGO.transform.position = characterPosition;
        character.targetPosition       = room.GetRandomFreeDancePosition();

        room.AddCharacter(character);

        if (!_hasSplitted && (_characterHand.numHandsDelivered > numVisitorHandsBeforeSplit))
        {
            introController.showChargeIntro = true;
            _hasSplitted = true;
        }
        else if (_characterHand.numHandsDelivered > (numVisitorHandsBeforeSplit + numVisitorHandsAfterSplit))
        {
            _hasStoppedSpawning = true;
        }
    }
Exemplo n.º 3
0
    public override string ToString()
    {
        string result = "Room Population:";

        for (int characterTypeIdx = 0; characterTypeIdx < numCharacters.Length; ++characterTypeIdx)
        {
            CharacterType characterType = (CharacterType)characterTypeIdx;
            result += "\n\tNum Type " + characterType.ToString() + ": " + numCharacters[characterTypeIdx].ToString();
        }
        result += "\n\nRoom Charge:";
        for (int chargeTypeIdx = 0; chargeTypeIdx < numCharges.Length; ++chargeTypeIdx)
        {
            CharacterCharge chargeType = (CharacterCharge)chargeTypeIdx;
            result += "\n\tNum Charge " + chargeType.ToString() + ": " + numCharges[chargeTypeIdx].ToString();
        }
        return(result);
    }