Example #1
0
    private void _initBall(StateTransform res)
    {
        res.transform.position = new Vector3(aPos.x, aPos.y, 0);
        float bsize = _checkDist / 4;

        res.transform.localScale = new Vector3(bsize, bsize, bsize);
    }
Example #2
0
    void LoadState(StateData stateData)
    {
        //find state object
        Transform parent = transform.Find(stateData.name);

        if (parent == null)
        {
            return;
        }

        //instiate prefab as child
        GameObject StateGO = Instantiate(StatePrefab, parent);

        //initialize gameobject behavior
        StateBehavior stateBehavior = StateGO.GetComponent <StateBehavior>();

        currStates.Add(stateBehavior);
        stateBehavior.Init(stateData);

        //change color of state
        StateTransform stateTransform = parent.GetComponent <StateTransform>();

        float.TryParse(stateData.positive, out float positiveCases);
        float percentOfTotal = positiveCases / (float)positiveTotal;

        stateTransform.SetColor(percentOfTotal);
    }
Example #3
0
 private bool _checkEnd(StateTransform ball)
 {
     if (Vector2.Distance(cPos, ball.transform.position) <= _checkDist)
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 private bool _chechHeight(StateTransform ball)
 {
     if (ball.transform.position.y <= _deleteH)
     {
         return(true);
     }
     return(false);
 }
Example #5
0
    private StateTransform _createBall()
    {
        var res = new StateTransform(Instantiate(Style.Ball));

        _initBall(res);
        _balls.Insert(0, res);
        _setComplexy();
        return(res);
    }
Example #6
0
 void Awake()
 {
     desiredScale   = Vector3.zero;
     stateTransform = GetComponentInParent <StateTransform>();
 }
Example #7
0
    private void _moving(StateTransform ball)
    {
        int id = ball.State;

        ball.transform.position = _trajectoryes[id].Get(ball.transform.position, _getDt(id));
    }