Esempio n. 1
0
 public void OnColourChanged(ShanghaiUtils.PaintColour colour)
 {
     Flash.ResetToBeginning();
     Flash.PlayForward();
     CurrentColor       = colour;
     ColourSprite.color = ShanghaiUtils.GetColour(colour);
 }
Esempio n. 2
0
        private IEnumerator PaintCell(float waitTime, Cell cell, ShanghaiUtils.PaintColour colour, int points)
        {
            yield return(new WaitForSeconds(waitTime));

            cell.Reset();
            cell.Colour   = colour;
            _Model.Point += points;
            Messenger <int, Cell> .Broadcast(ModelController.EVENT_POINTS_AWARDED, points, cell);

            RegenerateSurroundingCells(cell);
            Messenger <Cell> .Broadcast(Cell.EVENT_CELL_UPDATED, cell);
        }
Esempio n. 3
0
        public bool GenerateTarget()
        {
            IntVect2 cellKey = new IntVect2(0, 0);

            if (!_Model.Grid.GetRandomCell(ref cellKey))
            {
                return(false);
            }

            ShanghaiUtils.PaintColour targetColour = ShanghaiUtils.GetRandomColour(_Model.AvailableColours);
            Debug.Log("targetColour: " + targetColour);
            float  TTL    = _Config.TargetWaitTime;
            Target target = new Target(cellKey, targetColour, TTL);

            Messenger <Target> .Broadcast(EVENT_TARGET_CREATED, target);

            return(true);
        }
Esempio n. 4
0
 public void KillCell()
 {
     Reset();
     State  = Cell.CellState.DEAD;
     Colour = ShanghaiUtils.PaintColour.NONE;
 }
Esempio n. 5
0
 public Source(IntVect2 cellKey, float ttl, ShanghaiUtils.PaintColour colour)
 {
     CellKey     = cellKey;
     TTL         = ttl;
     PaintColour = colour;
 }
Esempio n. 6
0
 //TODO: (CM) Should this be here? It's more like behaviour
 public void ChangeColour()
 {
     _PaintColour = ShanghaiUtils.GetRandomColour(_AvailableColours);
     Messenger <ShanghaiUtils.PaintColour> .Broadcast(EVENT_COLOUR_CHANGED, _PaintColour);
 }
Esempio n. 7
0
 public Target(IntVect2 cellKey, ShanghaiUtils.PaintColour colour, float ttl)
 {
     CellKey     = cellKey;
     PaintColour = colour;
     TTL         = ttl;
 }