示例#1
0
    public IEnumerator Activate()
    {
        //StartCoroutine(PauseManager.Instance.PauseForSeconds(0.4f));
        this.activated       = true;
        this.renderer.sprite = this.onFrame;
        var effect = Instantiate(effectPrefab);

        effect.transform.position = this.transform.position;

        TweenSX.Add(gameObject, 0.3f, 2f).EaseOutBack().Then(() => { TweenSX.Add(gameObject, 0.2f, 1).EaseOutBack().Delay(0.2f); });
        TweenSY.Add(gameObject, 0.3f, 0.3f).EaseOutBack().Then(() => { TweenSY.Add(gameObject, 0.2f, 1).EaseOutBack().Delay(0.2f); });
        this.GetComponent <BoxCollider2D>().enabled = false;

        yield return(new WaitForSeconds(0.5f));

        var cinematics = Camera.main.GetComponent <ProCamera2DCinematics>();

        cinematics.AddCinematicTarget(objectToActivate.transform);
        PauseManager.Instance.PauseGame();
        var activatable = (IActivatable)objectToActivate;

        cinematics.OnCinematicTargetReached.AddListener((_) => { activatable.Activate(); });
        cinematics.OnCinematicFinished.AddListener(() => {
            PauseManager.Instance.UnpauseGame();
        });

        cinematics.Play();
    }
示例#2
0
 public void Stretch()
 {
     TweenSX.Add(gameObject, 0.1f, 0.7f).EaseOutBack().Then(() => { TweenSX.Add(gameObject, 0.1f, 1).EaseOutBack(); });
     TweenSY.Add(gameObject, 0.1f, 1.2f).EaseOutBack().Then(() => { TweenSY.Add(gameObject, 0.1f, 1).EaseOutBack(); });
 }
示例#3
0
 public void Squash(float time = 0.1f)
 {
     TweenSX.Add(gameObject, time, 2f).EaseOutBack().Then(() => { TweenSX.Add(gameObject, time, 1).EaseOutBack().Delay(0.2f); });
     TweenSY.Add(gameObject, time, 0.4f).EaseOutBack().Then(() => { TweenSY.Add(gameObject, time, 1).EaseOutBack().Delay(0.2f); });
 }
示例#4
0
 public TweenSY Squash(float time = 0.1f, float returnDelay = 0f)
 {
     TweenSX.Add(sprite, time, 1.4f).EaseOutBack().Then(() => { TweenSX.Add(sprite, time, 1).EaseOutBack().Delay(returnDelay); });
     return(TweenSY.Add(sprite, time, 0.5f).EaseOutBack().Then(() => { TweenSY.Add(sprite, time, 1).EaseOutBack().Delay(returnDelay); }));
 }