Exemple #1
0
    private void SetVisual(VisualType type)
    {
        currentVisual = type;

        EmptyVisual.SetActive(false);
        SeedVisual.SetActive(false);
        SproutVisual.SetActive(false);
        FullGrownVisual.SetActive(false);
        UsedVisual.SetActive(false);

        switch (type)
        {
        case VisualType.Empty:
            EmptyVisual.SetActive(true);
            break;

        case VisualType.Seed:
            SeedVisual.SetActive(true);
            break;

        case VisualType.Sprouted:
            SproutVisual.SetActive(true);
            break;

        case VisualType.FullGrown:
            FullGrownVisual.SetActive(true);
            break;

        case VisualType.Used:
            UsedVisual.SetActive(true);
            break;
        }
    }
Exemple #2
0
    private void SetVisual(VisualType type)
    {
        currentVisual = type;

        HarvestVisual.SetActive(false);
        SeedVisual.SetActive(false);
        WaterVisual.SetActive(false);
        DefaultVisual.SetActive(false);

        switch (type)
        {
        case VisualType.Default:
            DefaultVisual.SetActive(true);
            break;

        case VisualType.Planting:
            SeedVisual.SetActive(true);
            break;

        case VisualType.Watering:
            WaterVisual.SetActive(true);
            break;

        case VisualType.Harvesting:
            HarvestVisual.SetActive(true);
            break;
        }
    }
Exemple #3
0
    public void PushVisual(int score, VisualType type)
    {
        PoolObject po = _pool.ActivateObject("ScoreVisual");

        po.transform.SetParent(VisualParent);
        po.transform.localScale    = new Vector3(0.25f, 0.25f, 0.25f);
        po.transform.localPosition = new Vector3(0, 0, 0);
        string text = "";

        switch (type)
        {
        case VisualType.SWEET:
            text = "Sweet";
            break;

        case VisualType.COOL:
            text = "Cool";
            break;

        case VisualType.AWESOME:
            text = "Awesome!";
            break;

        case VisualType.MAJESTIC:
            text = "Majestic";
            break;

        case VisualType.ONFIRE:
            text = "On fire";
            break;

        case VisualType.GODLIKE:
            text = "Godlike";
            break;

        case VisualType.CHEAT:
            text = "CHEAT!";
            break;

        case VisualType.SOCLOSE:
            text = "So close";
            break;

        case VisualType.SUPERCLOSE:
            text = "Superclose!";
            break;

        case VisualType.WTF:
            text = "What the...";
            break;
        }
        po.GetComponent <VisualScript>().VisualText.text = text + " +" + score;
        po.GetComponent <Animator>().Play("Score_Addition");

        _visualList.Add(new Visual(0.5f, po));
    }
Exemple #4
0
 public void AddHitScore(int amount, VisualType type)
 {
     _background.Pulse();
     AddScore(amount * CurrentLevel, type);
     _currentTimer = PlayerTimerReset; // add for having strategy
     if (_timerAnim != null)
     {
         _timerAnim.Play("Countdown", -1, 0f);
     }
 }
Exemple #5
0
    private IEnumerator DoAction(VisualType actionVisual)
    {
        // pre action
        isPerformingAction = true;
        SetVisual(actionVisual);

        // do action
        yield return(new WaitForSeconds(actionDuration));

        // post action
        SetVisual(VisualType.Default);
        isPerformingAction = false;
    }
Exemple #6
0
    IEnumerator PushScore(int amount, VisualType type)
    {
        if (_scoreAnim != null)
        {
            _score.PushVisual(amount, type);
        }
        yield return(new WaitForSeconds(0.25f));

        _currentScore += amount;
        if (_scoreAnim != null && amount > 1)
        {
            _scoreAnim.Play("Bump", -1, 0f);
        }
    }
Exemple #7
0
        protected override void Update()
        {
            base.Update();

            UpdateWireType();

            if (_previousWireType != WireType)
            {
                switch (WireType)
                {
                case VisualType.Horizontal:
                case VisualType.Vertical:
                    SetImage(StraightWire, Color.white);
                    break;

                case VisualType.IntersectionT:
                    SetImage(WireT, Color.white);
                    break;

                case VisualType.IntersectionX:
                    SetImage(WireX, Color.white);
                    break;

                case VisualType.End:
                    SetImage(WireEnd, Color.white);
                    break;

                case VisualType.HorizontalBridge:
                case VisualType.VerticalBridge:
                    SetImage(Bridge, Color.white);
                    break;

                case VisualType.NoConnections:
                    SetImage(NoConnections, Color.white);
                    break;

                default:
                    SetImage(CornerWire, Color.white);
                    break;
                }

                _previousWireType = WireType;
            }

            if (_previousAngle != Rotation)
            {
                _previousAngle = Rotation;
                SetRotationAroundPivot(Rotation);
            }
        }
Exemple #8
0
        public static VisualType[] QueryVisualTypes()
        {
            IntPtr ptr;
            int    count;

            gdk_query_visual_types(out ptr, out count);
            int[] tmp = new int [count];
            Marshal.Copy(ptr, tmp, 0, count);
            VisualType[] result = new VisualType [count];
            for (int i = 0; i < count; i++)
            {
                result [i] = (VisualType)tmp [i];
            }
            return(result);
        }
Exemple #9
0
    public void AddScore(int amount, VisualType type)
    {
        if (amount <= 0)
        {
            return; // just ignore these values
        }
        StartCoroutine(PushScore(amount, type));

        int nextLevelScore = (int)(LevelProgressionScore * Mathf.Pow(_currentLevel, 2));

        if (_currentScore >= nextLevelScore)
        {
            LevelUp();
        }
    }
Exemple #10
0
    void AddComboCount(VisualType type)
    {
        switch (type)
        {
        case VisualType.SWEET:
            ++_sweetCount;
            break;

        case VisualType.COOL:
            ++_coolCount;
            break;

        case VisualType.AWESOME:
            ++_awesomeCount;
            break;

        case VisualType.MAJESTIC:
            ++_majesticCount;
            break;

        case VisualType.ONFIRE:
            ++_onfireCount;
            break;

        case VisualType.GODLIKE:
            ++_godlikeCount;
            break;

        case VisualType.CHEAT:
            ++_cheatCount;
            break;

        case VisualType.SOCLOSE:
            ++_soCloseCount;
            break;

        case VisualType.SUPERCLOSE:
            ++_superCloseCount;
            break;

        case VisualType.WTF:
            ++_wtfCount;
            break;
        }
    }
Exemple #11
0
        protected virtual void Awake()
        {
            //get references
            damageable        = GetComponent <Damageable>();
            damageableManager = GetComponent <DamageableManager>();
            thisCollider      = GetComponent <Collider>();
            navMeshObstacle   = GetComponent <NavMeshObstacle>();
            ISpeed            = navObstacle.GetComponent <ISpeed>();


            if (DamageableManager != null)
            {
                DamageableManager.OnDie.AddListener(delegate
                {
                    visualType = VisualType.DeadBody;
                });
            }

            range = (Collider is SphereCollider ? ((SphereCollider)Collider).radius : 0.0f);
        }
Exemple #12
0
 public static void SetVisual(VisualType value)
 {
     _vstype = (value > VisualType.WaveForm ? VisualType.SpectrumLineN : value);
 }
Exemple #13
0
 public CharacterVisualLayout(VisualType vtype)
 {
     this.Type = vtype;
 }
Exemple #14
0
 public bool HasEntity(long id, VisualType type) => EntitiesByVisualType.TryGetValue(type, out Dictionary <long, IEntity> entities) && entities.ContainsKey(id);
Exemple #15
0
 protected EntityBase(VisualType type, long id)
 {
     Type = type;
     Id   = id;
 }
Exemple #16
0
 public IEnumerable <T> GetEntitiesByType <T>(VisualType type) where T : class, IEntity
 {
     return(!EntitiesByVisualType.TryGetValue(type, out Dictionary <long, IEntity> entities) ? null : entities.Select(s => s.Value as T));
 }
Exemple #17
0
 public IEntity GetEntity(long id, VisualType type) =>
 EntitiesByVisualType.TryGetValue(type, out Dictionary <long, IEntity> entities) && entities.TryGetValue(id, out IEntity entity) ? entity : null;
Exemple #18
0
 public static VisualType[] QueryVisualTypes()
 {
     IntPtr ptr;
     int count;
     gdk_query_visual_types (out ptr, out count);
     int[] tmp = new int [count];
     Marshal.Copy (ptr, tmp, 0, count);
     VisualType[] result = new VisualType [count];
     for (int i = 0; i < count; i++)
         result [i] = (VisualType) tmp [i];
     return result;
 }
Exemple #19
0
 public T GetEntity <T>(long id, VisualType type) where T : class, IEntity => GetEntity(id, type) as T;
Exemple #20
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //Debug.Log("OnTriggerEnter");
        if (other.tag == "Bullet")
        {
            if (!_level.IsPlaying)
            {
                return; // you done goofed
            }
            _comboInteval = ComboInterval;
            ++_comboCount;

            VisualType type = VisualType.NONE;
            switch (_comboCount)
            {
            case 3:
                type = VisualType.SWEET;
                break;

            case 4:
                type = VisualType.COOL;
                break;

            case 5:
                type = VisualType.AWESOME;
                break;

            case 6:
                type = VisualType.MAJESTIC;
                break;

            case 7:
                type = VisualType.ONFIRE;
                break;

            case 8:
                type = VisualType.GODLIKE;
                break;

            default:
                if (_comboCount > 8)
                {
                    type = VisualType.CHEAT;
                }
                break;
            }

            BulletScript bullet     = other.GetComponent <BulletScript>();
            int          multiplier = 1;
            if (bullet.IsHit)
            {
                multiplier = 5;
                Debug.Log("Wtf...");
                type = VisualType.WTF;
            }
            else if (bullet.IsNearMiss)
            {
                multiplier = (int)Mathf.Pow(2, bullet.NearMisses);
                if (bullet.NearMisses > 1)
                {
                    type = VisualType.SOCLOSE;
                }
                else
                {
                    type = VisualType.SUPERCLOSE;
                }
            }

            int score = multiplier * _level.CurrentLevel * 10;
            score += 5 * (_comboCount - 1);

            _level.AddHitScore(score, type);
            bullet.Deactivate();
        }
    }