private IEnumerator AddExperiance(GameManager.GameRound round, UnityAction action)
    {
        float testTime = Time.unscaledTime;

        foreach (GameManager.GameRound.BonusExperiance.ExperianceType expType in GameManager.instance.ExperianceSettings.ExperianceOrder)
        {
            if (round.ExperianceGained.ContainsKey(expType))
            {
                PointText p = Instantiate <GameObject>(pointText, ProgressScreenRect).GetComponent <PointText>();
                p.SetText(GameManager.instance.ExperianceSettings.GetExperiance(expType).Name);
                p.SetSpeed(DisplaySpeedScale);
                yield return(new WaitForSecondsRealtime(0.5f / DisplaySpeedScale));

                int biggestStack = 0;
                foreach (KeyValuePair <Player, List <GameManager.GameRound.BonusExperiance> > keyValuePair in round.ExperianceGained[expType])
                {
                    biggestStack = Mathf.Max(biggestStack, keyValuePair.Value.Count);
                    foreach (GameManager.GameRound.BonusExperiance exp in keyValuePair.Value)
                    {
                        PlayerUIs[keyValuePair.Key].expBar.AddPoints(exp, 0.5f / DisplaySpeedScale);
                    }
                }


                yield return(new WaitForSecondsRealtime(0.5f / DisplaySpeedScale));
                //Debug.Log(testTime - Time.unscaledTime);
            }
        }
        StartCoroutine(ChangeAlpha(SkipProgressText, -1, 0.25f));
        StartCoroutine(ChangeAlpha(ContinueText, 1, 0.5f));
        // Setup the closing the progress screen by pressing start
        StartCoroutine(InvokeOnPressStart(round.players, delegate { PressStart(action); }));
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        myRigidBody   = GetComponent <Rigidbody2D>();
        myBoxCollider = GetComponent <BoxCollider2D>();
        gameLevel     = FindObjectOfType <GameLevel>();

        pointText = FindObjectOfType <PointText>();
    }
    protected override void TreadDie()
    {
        Debug.LogFormat("Enemy: {0} Die()", gameObject.name);
        gameManager.AddScore(100);
        PointText pointTextInstance = Instantiate(pointText, transform.position, new Quaternion());

        pointTextInstance.SetScore(100);
        animator.SetTrigger(triggerDieHash);
    }
Esempio n. 4
0
    private void OnPointClick(PointText point, string type, bool pressed)
    {
        if (!_points.TryGetValue(type, out var points))
        {
            throw new ArgumentException("Unsupported type", nameof(type));
        }

        var index         = points.IndexOf(point);
        var geometryPoint = new GeometryPoint {
            Name = point.Text, Index = index, Type = type
        };
        var existingIndex = _indices.IndexOf(geometryPoint);

        if (existingIndex >= 0 || !pressed)
        {
            _indices.RemoveAt(existingIndex);
            _line.positionCount = _indices.Count;
            LineDestroyed?.Invoke();
            return;
        }

        if (_line.positionCount >= maxSelection)
        {
            var positionCount = _line.positionCount;
            _points[_indices[positionCount - 1].Type][_indices[positionCount - 1].Index].ToggleWithoutNotify(false);
            _indices.RemoveAt(positionCount - 1);
            LineDestroyed?.Invoke(true);
        }

        _indices.Add(geometryPoint);
        _line.positionCount = _indices.Count;

        if (_line.positionCount != maxSelection)
        {
            return;
        }

        var linePoints = new Vector3[_line.positionCount];

        _line.GetPositions(linePoints);
        LineCreated?.Invoke(linePoints, _indices.ToArray());
    }
Esempio n. 5
0
        private static PathDetails ParsePath(XmlNode ObjectNode)
        {
            float          X          = float.Parse(ObjectNode.Attributes["x"].Value);
            float          Y          = float.Parse(ObjectNode.Attributes["y"].Value);
            string         EntityName = ObjectNode.Attributes["name"].Value.Trim();
            List <Vector2> Nodes      = new List <Vector2>();

            foreach (var PointText in ObjectNode.SelectSingleNode("polyline").Attributes["points"].Value.Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries))
            {
                int   IndexComma = PointText.IndexOf(',');
                float NodeX      = float.Parse(PointText.Substring(0, IndexComma).Trim());
                float NodeY      = float.Parse(PointText.Substring(IndexComma + 1).Trim());
                Nodes.Add(new Vector2(NodeX + X, NodeY + Y));
            }
            return(new PathDetails()
            {
                EntityName = EntityName,
                Nodes = Nodes
            });
        }
Esempio n. 6
0
        private void OnInstantAdd(string msg, object extra = null)
        {
            if (null == _point)
            {
                _point = new PointText
                {
                    HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
                };
            }

            if (!_hasAdded)
            {
                RootGrid.Children.Add(_point);
                _hasAdded = true;

                if (null == _tipsTimer)
                {
                    _tipsTimer = new DispatcherTimer {
                        Interval = new TimeSpan(0, 0, 0, 5)
                    };
                    _tipsTimer.Tick += (sender, args) =>
                    {
                        if (null != _point && _hasAdded)
                        {
                            RootGrid.Children.Remove(_point);
                            _hasAdded = false;
                        }

                        _tipsTimer.Stop();
                    };
                }

                _tipsTimer.Start();
            }
            else
            {
                _tipsTimer.Stop();
                _tipsTimer.Start();
            }
        }