Ejemplo n.º 1
0
        public void Render(SnakeGrid grid)
        {
            ChromaColor[] colors = { ChromaColor.White };
            int           i      = 0;

            foreach (var pos in tail)
            {
                ChromaColor color = colors[i++ % colors.Length];
                if (i == tail.Count)
                {
                    color = ChromaColor.Yellow;
                }
                if (IsDead)
                {
                    var coordHead = tail.Last();
                    grid.SetDataPixel(coordHead.x, coordHead.y, GridDataType.SNAKE, ChromaColor.Red);

                    color = ChromaColor.Black;
                    if (i >= deadAnimationIdx)
                    {
                        deadAnimationIdx++;
                        grid.SetDataPixel(pos.x, pos.y, GridDataType.SNAKE, color);
                        return;
                    }
                }
                grid.SetDataPixel(pos.x, pos.y, GridDataType.SNAKE, color);
            }
            if (IsDead)
            {
                IsDeadRendered = true;
            }
        }
    public void Consolidate(ChromaColor color)
    {
        if (bodyState == BodySubState.DESTROYED)
        {
            return;
        }

        if (bodyState == BodySubState.DEACTIVATED)
        {
            SetMaterial(rsc.coloredObjectsMng.GetWormBodyWireframeMaterial());
            bodyDestruction.Play();
            bodyState = BodySubState.DESTROYED;
            //col.enabled = false;
            col.isTrigger = true;
        }
        else
        {
            ChromaColor oldColor = this.color;
            this.color              = color;
            currentDamage           = 0;
            currentDamageWrongColor = 0;

            ColorEventInfo.eventInfo.oldColor = oldColor;
            ColorEventInfo.eventInfo.newColor = color;
            rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_SECTION_COLOR_CHANGED, ColorEventInfo.eventInfo);

            bodyState = BodySubState.SETTING;
            StartCoroutine(SetRandomColors());
        }
    }
Ejemplo n.º 3
0
 public void ImpactedByBarrel(ChromaColor barrelColor, float damage, Vector3 direction, PlayerController player)
 {
     if (currentState != null)
     {
         ChangeStateIfNotNull(currentState.ImpactedByBarrel(barrelColor, damage, direction, player));
     }
 }
Ejemplo n.º 4
0
    public void CreatePortal(ChromaColor color, float duration = portalDuration)
    {
        switch (color)
        {
        case ChromaColor.RED:
            InitPortal(redPSs, ref isRedStopping, ref redPortalDuration, duration);
            isRedStopping = false;
            break;

        case ChromaColor.GREEN:
            InitPortal(greenPSs, ref isGreenStopping, ref greenPortalDuration, duration);
            isGreenStopping = false;
            break;

        case ChromaColor.BLUE:
            InitPortal(bluePSs, ref isBlueStopping, ref bluePortalDuration, duration);
            isBlueStopping = false;
            break;

        case ChromaColor.YELLOW:
            InitPortal(yellowPSs, ref isYellowStopping, ref yellowPortalDuration, duration);
            isYellowStopping = false;
            break;

        default:
            break;
        }
    }
    private IEnumerator RandomizeAndExplode()
    {
        float       elapsedTime = 0;
        ChromaColor randomColor = ChromaColorInfo.Random;

        while (elapsedTime < bb.bodyColorsCarrouselMinTime)
        {
            randomColor = ChromaColorInfo.Random;
            SetMaterial(rsc.coloredObjectsMng.GetWormBodyMaterial(randomColor));

            yield return(new WaitForSeconds(bb.bodyColorsCarrouselChangeInterval));

            elapsedTime += bb.bodyColorsCarrouselChangeInterval;
        }

        bodyDeactivate[(int)randomColor].Play();
        voxelization.SpawnFakeVoxels();

        EnemyExplosionController explosion = rsc.poolMng.enemyExplosionPool.GetObject();

        if (explosion != null)
        {
            explosion.transform.position = transform.position;
            explosion.PlayAll(finalExplosionSoundFx);
        }

        rsc.rumbleMng.Rumble(0, 0.3f, 0.5f, 0.5f);
        rsc.camerasMng.PlayEffect(0, 0.3f, 0.25f);
        //Destroy(gameObject);
        gameObject.SetActive(false);
    }
Ejemplo n.º 6
0
	void FixedUpdate () {
        elapsedTime += (int)(Time.deltaTime * 1000);

        if(elapsedTime >= changeInterval)
        {
            elapsedTime -= changeInterval;
            if (currentColor != ChromaColor.YELLOW)
                currentColor++;
            else
                currentColor = ChromaColor.RED;

            ColorChangedEventInfo info = new ColorChangedEventInfo();
            info.newColor = currentColor;
            mng.eventManager.TriggerEvent(EventManager.EventType.COLOR_CHANGED, info);
            /*switch (currentColor)
            {
                case ChromaColor.RED:
                    mng.eventManager.TriggerEvent(EventManager.EventType.COLOR_RED);
                    break;
                case ChromaColor.GREEN:
                    mng.eventManager.TriggerEvent(EventManager.EventType.COLOR_GREEN);
                    break;
                case ChromaColor.BLUE:
                    mng.eventManager.TriggerEvent(EventManager.EventType.COLOR_BLUE);
                    break;
                case ChromaColor.YELLOW:
                    mng.eventManager.TriggerEvent(EventManager.EventType.COLOR_YELLOW);
                    break;
            }*/
        }
	}
    public void ResetColor(ChromaColor color)
    {
        if (bodyState == BodySubState.DESTROYED)
        {
            return;
        }

        ChromaColor oldColor = this.color;

        if (bodyState == BodySubState.DEACTIVATED)
        {
            ColorEventInfo.eventInfo.newColor = color;
            rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_SECTION_ACTIVATED, ColorEventInfo.eventInfo);
        }
        else
        {
            ColorEventInfo.eventInfo.oldColor = oldColor;
            ColorEventInfo.eventInfo.newColor = color;
            rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_SECTION_COLOR_CHANGED, ColorEventInfo.eventInfo);
        }

        this.color              = color;
        currentDamage           = 0;
        currentDamageWrongColor = 0;
        bodyState = BodySubState.SETTING;

        StartCoroutine(SetRandomColors());
    }
    void ColorChanged(EventInfo eventInfo)
    {
        ColorEventInfo info = (ColorEventInfo)eventInfo;
        currentColor = info.newColor;

        SetCurrentMaterials();
    }
Ejemplo n.º 9
0
    public void Play(ChromaColor color, AudioClip clip)
    {
        this.color       = color;
        audioSource.clip = clip;

        Play();
    }
    public void ImpactedByShot(ChromaColor shotColor, float damage, PlayerController player)
    {
        if (bodyState != BodySubState.NORMAL || invulnerable)
        {
            return;
        }

        blinkController.BlinkWhiteOnce();

        if (shotColor != color && !rsc.debugMng.alwaysKillOk)
        {
            currentDamageWrongColor += damage * bb.HealthSettingsPhase.bodyWrongColorDamageModifier;

            if (currentDamageWrongColor >= bb.HealthSettingsPhase.bodyMaxHealth)
            {
                bodyState = BodySubState.DEACTIVATED; //not really deactivated but flagged to allow notify properly when colors reset

                explosionWrongSoundFx.Play();
                rsc.rumbleMng.Rumble(player.Id, 0.25f, 0f, 0.5f);
                rsc.camerasMng.PlayEffect(0, 0.25f, 0.2f);

                EnemyDiedEventInfo.eventInfo.color           = color;
                EnemyDiedEventInfo.eventInfo.infectionValue  = 0;
                EnemyDiedEventInfo.eventInfo.killerPlayer    = player;
                EnemyDiedEventInfo.eventInfo.killedSameColor = (color == shotColor);
                EnemyDiedEventInfo.eventInfo.specialKill     = false;
                rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_SECTION_DESTROYED, EnemyDiedEventInfo.eventInfo);

                player.ColorMismatch();

                head.DischargeHead();
            }
        }
        else
        {
            currentDamage += damage;

            if (currentDamage >= bb.HealthSettingsPhase.bodyMaxHealth)
            {
                //Set material grey
                SetMaterial(rsc.coloredObjectsMng.GetWormBodyGreyMaterial());
                bodyDeactivate[(int)color].Play();
                bodyState = BodySubState.DEACTIVATED;

                explosionOkSoundFx.Play();
                rsc.rumbleMng.Rumble(player.Id, 0.25f, 0f, 0.5f);
                rsc.camerasMng.PlayEffect(0, 0.25f, 0.2f);

                EnemyDiedEventInfo.eventInfo.color           = color;
                EnemyDiedEventInfo.eventInfo.infectionValue  = 0;
                EnemyDiedEventInfo.eventInfo.killerPlayer    = player;
                EnemyDiedEventInfo.eventInfo.killedSameColor = (color == shotColor);
                EnemyDiedEventInfo.eventInfo.specialKill     = false;
                rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_SECTION_DESTROYED, EnemyDiedEventInfo.eventInfo);

                head.ChargeHead();
            }
        }
    }
Ejemplo n.º 11
0
    private ChromaColor GetColor()
    {
        ChromaColor result;

        //If there is no color enemies in the scene, standard sequence
        if (TotalColorItems() == 0)
        {
            result = currentColor;

            if (result == ChromaColorInfo.Last)
            {
                result = ChromaColorInfo.First;
            }
            else
            {
                result++;
            }
        }
        else
        {
            //If there is only one color of enemies, change between that color and a random one
            if (TotalColorsWithItems() == 1)
            {
                ChromaColor itemsColor = GetFirstColorWithItems();

                if (currentColor != itemsColor)
                {
                    result = itemsColor;
                }
                else
                {
                    do
                    {
                        result = ChromaColorInfo.Random;
                    }while (result == itemsColor);
                }
            }
            //If there is more than one color of enemies, change between their colors
            else
            {
                result = currentColor;

                ////Search first color in loop that has items
                do
                {
                    if (result == ChromaColorInfo.Last)
                    {
                        result = ChromaColorInfo.First;
                    }
                    else
                    {
                        result++;
                    }
                }while (colorCount[(int)result] <= 0);
            }
        }

        return(result);
    }
Ejemplo n.º 12
0
 void Awake()
 {
     //Debug.Log("Color Manager created");
     prewarnInterval = changeInterval - prewarningSeconds;
     active          = false;
     currentColor    = ChromaColorInfo.Random;
     newColor        = currentColor;
 }
Ejemplo n.º 13
0
    void ColorChanged(EventInfo eventInfo)
    {
        ColorEventInfo info = (ColorEventInfo)eventInfo;

        currentColor = info.newColor;

        SetCurrentMaterials();
    }
Ejemplo n.º 14
0
 // Use this for initialization
 void Awake()
 {
     player1           = null;
     player2           = null;
     blinkController   = GetComponent <BlinkController>();
     knockedOutYOffset = knockedOutFx.transform.localPosition.y;
     currentColor      = ChromaColor.RED;
 }
Ejemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     showTimeEnabled = true;
     showElapsedTime = 0f;
     showTime        = Random.Range(showTimeMin / 2, showTimeMax / 2); //First time shows earlier
     currentColor    = ChromaColorInfo.Random;
     totalChances    = fallChances + passChances + swimChances + flyChances;
 }
Ejemplo n.º 16
0
 private void NotifyNewColor()
 {
     if (currentColor != newColor)
     {
         currentColor = newColor;
         SendNewColorEvent();
     }
 }
Ejemplo n.º 17
0
 public void ImpactedByShot(ChromaColor shotColor, int damage)
 {
     if (shotColor == color)
     {
         TakeDamage(damage);
     }
     //Else future behaviour like duplicate or increase health
 }
Ejemplo n.º 18
0
    public override WormAIBaseState ImpactedByShot(ChromaColor shotColor, float damage, PlayerController player)
    {
        if (subState != SubState.FOLLOWING_PATH)
        {
            return(null);
        }

        return(head.ProcessShotImpact(shotColor, damage, player));
    }
Ejemplo n.º 19
0
 public void SetDataPixel(int x, int y, GridDataType pixelType, ChromaColor color)
 {
     if (x < 0 || y < 0 || x >= Width || y >= Height)
     {
         throw new IndexOutOfRangeException("x or y coordinates out of range!");
     }
     grid[y, x + 1] = color;
     gameGrid[y, x] = pixelType;
 }
Ejemplo n.º 20
0
 public void Activate()
 {
     rsc.eventMng.StartListening(EventManager.EventType.COLOR_CHANGED, ColorChanged);
     if (colorPrewarnBlink)
     {
         rsc.eventMng.StartListening(EventManager.EventType.COLOR_WILL_CHANGE, ColorPrewarn);
     }
     currentColor = rsc.colorMng.CurrentColor;
     SetMaterial();
 }
 //public SpawnSpiderWaveAction(ChromaColor c,  Transform spPoint, List<AIAction> def, List<AIAction> close, List<AIAction> att, float del = 0f)
 public SpawnSpiderWaveAction(ChromaColor c, string spPoint, List<AIAction> def, List<AIAction> close, List<AIAction> att, float del = 0f)
 {
     colorMode = ColorMode.FIXED;
     color = c;
     spawnPoint = spPoint;
     defaultActions = def;
     closeActions = close;
     attackChipActions = att;
     delay = del;
 }
Ejemplo n.º 22
0
    private void SetNewColor()
    {
        ChromaColor color = GetColor();

        if (currentColor != color)
        {
            currentColor = color;
            SendNewColorEvent();
        }
    }
Ejemplo n.º 23
0
    public void EnemyKilledOk(ChromaColor color, bool specialKill)
    {
        ++enemiesKilledOk;

        int total;

        if (specialKill)
        {
            total = currentLevelStats != null ? currentLevelStats.specialKillsChainIncrement : 0;

            //To force start a chain
            if (currentIncrement == 0)
            {
                ++currentIncrement;
                lastKillColor = color;
            }
        }
        else
        {
            //If it was a chain ongoing
            if (currentIncrement > 0)
            {
                if (color == lastKillColor)
                {
                    ++currentIncrement;
                }
                else
                {
                    currentIncrement = 1;
                    lastKillColor    = color;
                }
            }
            //Start chain
            else
            {
                ++currentIncrement;
                lastKillColor = color;
            }

            total = currentIncrement;
        }

        currentChain += total;
        if (currentChain > maxChain)
        {
            maxChain = currentChain;
        }

        chainRemainingTime = currentLevelStats != null ? currentLevelStats.chainMaxTime : 0;

        ComboEventInfo.eventInfo.playerId   = playerId;
        ComboEventInfo.eventInfo.comboColor = lastKillColor;
        ComboEventInfo.eventInfo.comboAdd   = total;
        rsc.eventMng.TriggerEvent(EventManager.EventType.COMBO_ADD, ComboEventInfo.eventInfo);
    }
Ejemplo n.º 24
0
 public virtual void ProcessColorChanged(ChromaColor newColor)
 {
     if (color == newColor)
     {
         shields[(int)color].SetActive(false);
     }
     else
     {
         shields[(int)color].SetActive(true);
     }
 }
	void Start ()
    {
        Debug.Log("Colored Objects Manager created");

        playerShotPool = rsc.poolMng.playerShotPool;
        spiderPool = rsc.poolMng.spiderPool;
        voxelPool = rsc.poolMng.voxelPool;
        rsc.eventMng.StartListening(EventManager.EventType.COLOR_CHANGED, ColorChanged);
        currentColor = rsc.colorMng.CurrentColor;
        SetCurrentMaterials();
    }
Ejemplo n.º 26
0
    private void PrecalculateColor()
    {
        colorPrecalculated = true;

        newColor = GetColor();

        if (currentColor != newColor)
        {
            SendNextColorEvent();
        }
    }
Ejemplo n.º 27
0
    public VoxelController GetVoxel(ChromaColor color)
    {
        //Get a voxel from pool
        VoxelController voxel = voxelPool.GetObject();

        if (voxel != null)
        {
            voxel.GetComponent <Renderer>().sharedMaterial = GetMaterial(voxelMats, color);
        }

        return(voxel);
    }
    public void SetInitialState(ChromaColor c)
    {
        color                   = c;
        currentDamage           = 0;
        currentDamageWrongColor = 0;
        SetMaterial(rsc.coloredObjectsMng.GetWormBodyMaterial(color));

        ColorEventInfo.eventInfo.newColor = color;
        rsc.eventMng.TriggerEvent(EventManager.EventType.WORM_SECTION_ACTIVATED, ColorEventInfo.eventInfo);

        bodyState = BodySubState.NORMAL;
    }
Ejemplo n.º 29
0
    public WormAIBaseState ProcessShotImpact(ChromaColor shotColor, float damage, PlayerController player)
    {
        blinkController.BlinkWhiteOnce();

        bb.headCurrentDamage += damage;

        if (bb.headCurrentDamage >= bb.HealthSettingsPhase.headMaxHealth)
        {
            return(knockOutState);
        }

        return(null);
    }
Ejemplo n.º 30
0
    public MosquitoAIBehaviour GetMosquito(int offset, Vector3 position)
    {
        int colorIndex = ((int)currentColor + offset) % ChromaColorInfo.Count;

        //Offset can be negative
        if (colorIndex < 0)
        {
            colorIndex = ChromaColorInfo.Count + colorIndex;
        }

        ChromaColor color = (ChromaColor)colorIndex;

        return(GetMosquito(color, position));
    }
Ejemplo n.º 31
0
    public MosquitoAIBehaviour GetMosquito(ChromaColor color, Vector3 position)
    {
        //Get a mosquito from pool
        MosquitoAIBehaviour mosquito = mosquitoPool.GetObject(position);

        if (mosquito != null)
        {
            mosquito.color = color;
            mosquito.SetMaterials(new[] { GetMaterial(mosquitoMats, color), GetMaterial(mosquitoLightSpotMats, color) });

            return(mosquito);
        }

        return(null);
    }
Ejemplo n.º 32
0
    // Update is called once per frame
    void Update()
    {
        if (showTimeEnabled)
        {
            showElapsedTime += Time.deltaTime;
            if (showElapsedTime >= showTime)
            {
                //Pick a random color
                ChromaColor newColor = ChromaColorInfo.Random;
                //Force new color every time
                while (currentColor == newColor)
                {
                    newColor = ChromaColorInfo.Random;
                }

                currentColor = newColor;

                Color color = rsc.coloredObjectsMng.GetPlayerColor(newColor);

                matColor.SetColor("_EmissionColor", color);
                matShield.SetColor("_EmissionColor", color);

                showElapsedTime = 0f;
                showTimeEnabled = false;
                showTime        = Random.Range(showTimeMin, showTimeMax);

                //Pick a random effect
                float dice = Random.Range(0f, totalChances);

                if (dice <= fallChances)
                {
                    StartCoroutine(KDTFall());
                }
                else if (dice <= fallChances + passChances)
                {
                    StartCoroutine(KDTPass());
                }
                else if (dice <= fallChances + passChances + swimChances)
                {
                    StartCoroutine(KDTSwim());
                }
                else
                {
                    StartCoroutine(KDTFly());
                }
            }
        }
    }
Ejemplo n.º 33
0
    public SpiderAIBehaviour GetSpider(ChromaColor color, Vector3 position)
    {
        //Get a spider from pool
        SpiderAIBehaviour spider = spiderPool.GetObject(position);

        if (spider != null)
        {
            spider.color = color;

            spider.SetMaterials(new[] { GetMaterial(spiderMats, color) });

            return(spider);
        }

        return(null);
    }
Ejemplo n.º 34
0
        public void SetDataPixel(int x, int y, GridDataType pixelType)
        {
            ChromaColor c = ChromaColor.Black;

            switch (pixelType)
            {
            case GridDataType.WALL:
                c = ChromaColor.Green;
                break;

            case GridDataType.EMPTY:
                c = ChromaColor.Black;
                break;
            }
            SetDataPixel(x, y, pixelType, c);
        }
Ejemplo n.º 35
0
    public void ImpactedByShot(ChromaColor shotColor, float damage, PlayerController player)
    {
        if (headState != HeadSubState.ACTIVATED || invulnerable)
        {
            return;
        }

        if (currentState != null)
        {
            WormAIBaseState newState = currentState.ImpactedByShot(shotColor, damage, player);

            if (newState != null)
            {
                ChangeState(newState);
            }
        }
    }
Ejemplo n.º 36
0
    void ColorChanged(EventInfo eventInfo)
    {
        ColorEventInfo info = (ColorEventInfo)eventInfo;
        currentColor = info.newColor;

        switch (currentColor)
        {
            case ChromaColor.RED:
                currentMaterial = redMaterial;
                break;
            case ChromaColor.GREEN:
                currentMaterial = greenMaterial;
                break;
            case ChromaColor.BLUE:
                currentMaterial = blueMaterial;
                break;
            case ChromaColor.YELLOW:
                currentMaterial = yellowMaterial;
                break;
        }
    }
    public Material GetPlayerShotMaterial(ChromaColor color)
    {
        switch (color)
        {
            case ChromaColor.RED:
                return playerShotRed;
            case ChromaColor.GREEN:
                return playerShotGreen;
            case ChromaColor.BLUE:
                return playerShotBlue;
            case ChromaColor.YELLOW:
                return playerShotYellow;
        }

        return null; //Should not reach here
    }
Ejemplo n.º 38
0
 void ColorChanged(EventInfo eventInfo)
 {
     currentColor = ((ColorEventInfo)eventInfo).newColor;
     SetMaterial();
 }
    public SpiderAIBehaviour GetSpider(ChromaColor color)
    {
        //Get a spider from pool
        GameObject spider = spiderPool.GetObject();

        if (spider != null)
        {
            SpiderAIBehaviour spiderAI = spider.GetComponent<SpiderAIBehaviour>();
            spiderAI.color = color;
            Material[] mats = spiderAI.spiderRenderer.materials;
            switch (color)
            {
                case ChromaColor.RED:
                    mats[1] = spiderRed;
                    break;
                case ChromaColor.GREEN:
                    mats[1] = spiderGreen;
                    break;
                case ChromaColor.BLUE:
                    mats[1] = spiderBlue;
                    break;
                case ChromaColor.YELLOW:
                    mats[1] = spiderYellow;
                    break;
            }
            spiderAI.spiderRenderer.materials = mats;

            return spiderAI;
        }

        return null;
    }
Ejemplo n.º 40
0
 void Start()
 {
     coloredObjMng = rsc.coloredObjectsMng;
     rsc.eventMng.StartListening(EventManager.EventType.COLOR_CHANGED, ColorChanged);
     currentColor = rsc.colorMng.CurrentColor;
     SetMaterial();
 }
    public Material GetSpiderMaterial(ChromaColor color)
    {
        switch (color)
        {
            case ChromaColor.RED:
                return spiderRed;
            case ChromaColor.GREEN:
                return spiderGreen;
            case ChromaColor.BLUE:
                return spiderBlue;
            case ChromaColor.YELLOW:
                return spiderYellow;
        }

        return null; //Should not reach here
    }
    public GameObject GetPlayerShot(ChromaColor color)
    {
        //Get a shot from pool
        GameObject shot = playerShotPool.GetObject();

        if (shot != null)
        {
            switch (color)
            {
                case ChromaColor.RED:
                    shot.GetComponent<Renderer>().material = playerShotRed;
                    break;
                case ChromaColor.GREEN:
                    shot.GetComponent<Renderer>().material = playerShotGreen;
                    break;
                case ChromaColor.BLUE:
                    shot.GetComponent<Renderer>().material = playerShotBlue;
                    break;
                case ChromaColor.YELLOW:
                    shot.GetComponent<Renderer>().material = playerShotYellow;
                    break;
            }
            shot.GetComponent<PlayerShotController>().color = color;
        }

        return shot;
    }
Ejemplo n.º 43
0
    private void SetNewColor()
    {
        //If there is no color enemies in the scene, no color change
        if (TotalColorItems() == 0) return;

        //Search first color in loop that has items
        do
        {
            if (currentColor == ChromaColorInfo.Last)
                currentColor = ChromaColorInfo.First;        
            else
                currentColor++;
        }
        while (colorCount[(int)currentColor] <= 0);

        mng.eventManager.TriggerEvent(EventManager.EventType.COLOR_CHANGED, new ColorEventInfo { newColor = currentColor });
    }
    public VoxelController GetVoxel(ChromaColor color)
    {
        //Get a voxel from pool
        VoxelController voxel = voxelPool.GetObject();

        if (voxel != null)
        {
            switch (color)
            {
                case ChromaColor.RED:
                    voxel.GetComponent<Renderer>().material = voxelRed;
                    break;
                case ChromaColor.GREEN:
                    voxel.GetComponent<Renderer>().material = voxelGreen;
                    break;
                case ChromaColor.BLUE:
                    voxel.GetComponent<Renderer>().material = voxelBlue;
                    break;
                case ChromaColor.YELLOW:
                    voxel.GetComponent<Renderer>().material = voxelYellow;
                    break;
            }
        }

        return voxel;
    }
    public Material GetVoxelMaterial(ChromaColor color)
    {
        switch (color)
        {
            case ChromaColor.RED:
                return voxelRed;
            case ChromaColor.GREEN:
                return voxelGreen;
            case ChromaColor.BLUE:
                return voxelBlue;
            case ChromaColor.YELLOW:
                return voxelYellow;
        }

        return null; //Should not reach here
    }
Ejemplo n.º 46
0
 public void SetMaterial(ChromaColor color)
 {
     mat = colorObjMng.GetVoxelMaterial(color);
 }
Ejemplo n.º 47
0
 // Use this for initialization
 void Start () {
     currentColor = ChromaColor.RED;
 }
Ejemplo n.º 48
0
 public void SetMaterial(ChromaColor color)
 {
     switch(color)
     {
         case ChromaColor.RED: mat = redMaterial; break;
         case ChromaColor.GREEN: mat = greenMaterial; break;
         case ChromaColor.BLUE: mat = blueMaterial; break;
         case ChromaColor.YELLOW: mat = yellowMaterial; break;
     }
 }
Ejemplo n.º 49
0
    public void TakeDamage(int damage, ChromaColor color)
    {
        // only for enemy bullets
        /*
        if(color != currentColor)
        {
            TakeDamage(damage);
        }
        */

        TakeDamage(damage);

    }
Ejemplo n.º 50
0
 public void TakeDamage(int damage, ChromaColor color)
 {
     
 }
Ejemplo n.º 51
0
 public void Init()
 {
     currentColor = ChromaColor.RED;
     mng.eventManager.StartListening(EventManager.EventType.ENEMY_SPAWNED, EnemySpawned);
     mng.eventManager.StartListening(EventManager.EventType.ENEMY_DIED, EnemyDied);
 }