public void BlobJoinAnimation(GameObject p_target, Vector3 p_from) { //p_target.GetComponent<Renderer>().enabled = true; hookPivots[hookPivots.Count - 1].GetComponent <HookController>().SetBodySprite(false); p_target.GetComponent <SpriteBubbleManager>().ActivateObjects(true); //p_target.transform.SetParent(null); //p_target.transform.localScale = Vector3.one * 3; Vector2 __startingPosition = p_target.transform.position; //p_target.transform.SetParent(transform); PotaTween __pTween = p_target.GetComponent <PotaTween>(); __pTween.Clear(); __pTween.SetPosition(p_from, transform.position); __pTween.SetEaseEquation(Ease.Equation.InSine); __pTween.UpdateCallback(delegate { //Debug.Log(new Vector2((p_target.transform.position.x - __startingPosition.x), p_target.transform.position.y - __startingPosition.y)); //p_target.transform.position = (Vector2)transform.position + ((__startingPosition - (Vector2)p_target.transform.position) * __pTween.Float.Value); __pTween.Position.To = (Vector2)transform.position; }); __pTween.Play(delegate { //p_target.GetComponent<Renderer>().enabled = false; hookPivots[hookPivots.Count - 1].GetComponent <HookController>().SetBodySprite(true); p_target.GetComponent <SpriteBubbleManager>().ActivateObjects(false); }); }
public virtual void OnPanelEnable() { PotaTween tween = animEnable.Initialize(gameObject); tween.Play(() => { GetComponent <CanvasGroup>().interactable = true; }); }
public virtual void OnPanelDisable() { PotaTween tween = animDisable.Initialize(gameObject); tween.Play(() => { gameObject.SetActive(false); }); GetComponent <CanvasGroup>().interactable = false; }
public void StartAttack() { if (readyToFire) { readyToFire = false; hookTip.SetActive(true); //set the animation parameters _potaTween.Clear(); _potaTween.SetScale(preAttackScale, attackTargetScale); _potaTween.SetEaseEquation(Ease.Equation.OutSine); _potaTween.SetDuration(0.4f); _potaTween.Play(delegate { StopAttack(); }); //tailSprite.GetComponent<Animator>().SetTrigger("Attack"); } }
public void GrowingAnimation(float p_delay) { if (GetComponent <PotaTween>() == null) { PotaTween.Create(gameObject); } PotaTween __pTween = GetComponent <PotaTween>(); __pTween.SetScale(transform.localScale, Vector3.one * (10 + (capturedPlayersStack.Count))); __pTween.SetEaseEquation(Ease.Equation.OutElastic); __pTween.SetDelay(p_delay); __pTween.Play(delegate { UpdateHookPivots(); }); //UpdateHookPivots(); }
public void UpdateHookPivots() { float __archSize = (2 * Mathf.PI) / hookPivots.Count; for (int i = 0; i < hookPivots.Count; i++) { //atualiza o parent do pivot hookPivots[i].transform.parent.parent = gameObject.transform; hookPivots[i].transform.parent.position = transform.position; //hookPivots[i].transform.localScale = Vector3.one/2; hookPivots[i].transform.parent.localScale = Vector3.one; //calcula o novo ângulo float __targetAngle = i * __archSize; int __num = i; //coloca tween nos pivots, ou confere se eles já têm if (hookPivots[i].GetComponent <PotaTween>() == null) { PotaTween.Create(hookPivots[i].gameObject); } PotaTween __pTween = hookPivots[i].GetComponent <PotaTween>(); __pTween.Clear(); __pTween.SetFloat(hookPivots[i].transform.eulerAngles.z, __targetAngle * Mathf.Rad2Deg); __pTween.UpdateCallback(delegate() { if (hookPivots.Count > __num) { hookPivots[__num].transform.parent.eulerAngles = new Vector3(0, 0, __pTween.Float.Value); } }); //ativa o tween pra ir pra posição __pTween.Play(); } }