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); }
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); }
private bool _checkEnd(StateTransform ball) { if (Vector2.Distance(cPos, ball.transform.position) <= _checkDist) { return(true); } return(false); }
private bool _chechHeight(StateTransform ball) { if (ball.transform.position.y <= _deleteH) { return(true); } return(false); }
private StateTransform _createBall() { var res = new StateTransform(Instantiate(Style.Ball)); _initBall(res); _balls.Insert(0, res); _setComplexy(); return(res); }
void Awake() { desiredScale = Vector3.zero; stateTransform = GetComponentInParent <StateTransform>(); }
private void _moving(StateTransform ball) { int id = ball.State; ball.transform.position = _trajectoryes[id].Get(ball.transform.position, _getDt(id)); }