示例#1
0
    private void ActivateSprite(Vector2 position)
    {
        if (BoardAgent.GetSpriteEnabled(position))
        {
            return;
        }

        BoardAgent.SetSpriteImage(position, SpriteAgent.GetCurrentSprite());

        Color color = ColorAgent.GetCurrentColorPack().foregroundColor;

        if (color == ColorAgent.RainbowColor)
        {
            BoardAgent.SetSpriteColor(position, Utilities.ColorFromHSV(((position.y / (float)BoardAgent.BoardHeight) * 360f + colorOffset) % 360f, 1f, 1f));
        }
        else if (color == ColorAgent.RandomColor)
        {
            BoardAgent.SetSpriteColor(position, Utilities.ColorFromHSV(Random.Range(0f, 360f), 1f, 1f));
        }
        else
        {
            BoardAgent.SetSpriteColor(position, color);
        }

        BoardAgent.SetSpriteScale(position, new Vector3(BoardAgent.CellSize * (Random.value < 0.5f ? 1f : -1f), BoardAgent.CellSize * (Random.value < 0.5f ? 1f : -1f), 1f));
        BoardAgent.SetSpriteEnabled(position, true);
    }
示例#2
0
 private void UpdateScreenPosition()
 {
     for (int i = 0; i < segments.Count; i++)
     {
         float newXPosition = BoardAgent.ChannelPositionToScreenPosition(currentChannelPositions[i], isDefender).x;
         segments[i].transform.position = new Vector3(newXPosition, segments[i].transform.position.y, 0f);
     }
 }
示例#3
0
    void Awake()
    {
        if( mInstance != null )
        {
            Debug.LogError( "Only one instance of BoardAgent allowed. Destroying " + gameObject + " and leaving " + mInstance.gameObject );
            Destroy( gameObject );
            return;
        }

        mInstance = this;
    }
示例#4
0
    void Awake()
    {
        if (mInstance != null)
        {
            Debug.LogError("Only one instance of BoardAgent allowed. Destroying " + gameObject + " and leaving " + mInstance.gameObject);
            Destroy(gameObject);
            return;
        }

        mInstance = this;
    }
示例#5
0
    public void Reset()
    {
        int randomValue = Mathf.FloorToInt(Random.value * 3f);

        switch (randomValue)
        {
        case 0: numSegments = 1; shotSpeedPercent = 2f; break;

        case 1: numSegments = 2; shotSpeedPercent = 1f; break;

        case 2: numSegments = 4; shotSpeedPercent = 0.5f; break;
        }

        currentChannelPositions.Clear();

        for (int i = 0; i < segments.Count; i++)
        {
            Destroy(segments[i]);
        }

        segments.Clear();

        StopCoroutine("RunShotsFired");
        DestroyShotsFired();

        for (int i = 0; i < numSegments; i++)
        {
            if (numSegments == 4 && i > 1)
            {
                currentChannelPositions.Add((BoardAgent.NumChannels / 2 + (i - 3) * (isDefender ? 1 : -1)));
                segments.Add(Instantiate(MonAgent.GetMonPrefab(), BoardAgent.ChannelPositionToScreenPosition(currentChannelPositions[i], isDefender) + Vector3.up * BoardAgent.ChannelWidth * (isDefender ? 1f : -1f), rotation) as GameObject);
            }
            else
            {
                currentChannelPositions.Add((BoardAgent.NumChannels / 2 + (i - 1) * (isDefender ? 1 : -1)));
                segments.Add(Instantiate(MonAgent.GetMonPrefab(), BoardAgent.ChannelPositionToScreenPosition(currentChannelPositions[i], isDefender), rotation) as GameObject);
            }

            segments[i].transform.parent     = transform;
            segments[i].transform.localScale = Vector3.one * BoardAgent.ChannelWidth * 0.75f;
        }
    }
示例#6
0
    void Awake()
    {
        if (mInstance != null)
        {
            Debug.LogError(string.Format("Only one instance of BoardAgent allowed! Destroying:" + gameObject.name + ", Other:" + mInstance.gameObject.name));
            Destroy(gameObject);
            return;
        }

        mInstance = this;

        if (!PlayerPrefs.HasKey(useDetailString))
        {
            PlayerPrefs.SetInt(useDetailString, 1);
        }

        useDetail = (PlayerPrefs.GetInt(useDetailString) == 1);

        if (detailText)
        {
            detailText.text = (useDetail ? "Oleg on" : "Oleg off");
        }
    }
示例#7
0
    private void internalChangeState(State newState)
    {
        if (currentState == newState)
        {
            return;
        }

        currentState = newState;

        switch (currentState)
        {
        case State.Ready:
        {
            showUI = true;
            SetUIEnabled(false);
            TipAgent.ShowFirstTip();
            UpdateNavigationHighlight(true);

            ColorAgent.AdvanceColorPack();

            SpriteAgent.ClearSpriteNames();

            BoardAgent.ResetBoard();
            ShuffleDeck();
            colorOffset = Random.Range(0f, 360f);
            SpriteAgent.Randomize();

            index = 0;
        } break;

        case State.Printing:
        {
            SetUIEnabled(false);

            speed = (float)BoardAgent.BoardSize / fillTime;

            SpriteAgent.LogSpriteName();

            AudioAgent.PlaySoundEffect(AudioAgent.SoundEffectType.Print, fillTime);
            AudioAgent.PitchSoundEffect(AudioAgent.SoundEffectType.Print, 1f);

            if (index == 0)
            {
                StartCoroutine("DoPrint");
            }
        } break;

        case State.Paused:
        {
            TipAgent.ShowNextTip();
            SetUIEnabled(true);

            speed = 0f;

            AudioAgent.PauseSoundEffect(AudioAgent.SoundEffectType.Print);
        } break;

        case State.FastForwarding:
        {
            SetUIEnabled(false);

            speed = (float)BoardAgent.BoardSize / fillTime * 5f;

            AudioAgent.PitchSoundEffect(AudioAgent.SoundEffectType.Print, 2f);

            wasFastForwarding = true;
        } break;

        case State.Finished:
        {
            showUI = true;
            TipAgent.ShowNextTip();
            SetUIEnabled(true);
        } break;

        case State.Advertising:
        {
            SetUIEnabled(false);
            RatingAgent.CheckForPrompt();
            //AdAgent.ShowInterstitialImage();
        } break;
        }
    }