Пример #1
0
        // todo: use objects pool, not recreate
        public CAnimation Require(EAnimations type, Vector3 position)
        {
            var anim = Create(type, position);

            anim.SetListener(null);
            return(anim);
        }
Пример #2
0
    // Sends a request to the animator to play an animation
    public void PlayAnimation(EAnimations animation)
    {
        if (characterAnimator != null)
        {
            switch (animation)
            {
            case EAnimations.Idle:
                //necesary? Could force set to idle from "AnyState" ?
                break;

            case EAnimations.Jump:
                characterAnimator.SetTrigger("tJump");
                break;

            case EAnimations.TurnLeft:
                characterAnimator.SetTrigger("tTurnLeft");
                break;

            case EAnimations.TurnRight:
                characterAnimator.SetTrigger("tTurnRight");
                break;

            default:
                break;
            }
        }
        else
        {
            Debug.LogWarning("Character Animator not found!");
        }
    }
Пример #3
0
        public CAnimation Create(EAnimations type, Vector3 position)
        {
            var prefab = CGame.Config.match.die.GetPrefab(type);

            GameObject gameObject = Instantiate(prefab) as GameObject;

            gameObject.transform.SetParent(this.transformParent);
            gameObject.transform.localScale = new Vector3(100, 100, 1);
            gameObject.transform.position   = position;

            var anim = gameObject.GetComponent <CAnimation>();

            anim.SetAnimations(this);

            return(anim);
        }
Пример #4
0
        public GameObject GetPrefab(EAnimations type)
        {
            switch (type)
            {
            case EAnimations.Bolt: return(Bolt);

            case EAnimations.Contour: return(Contour);

            case EAnimations.Explosion: return(Explosion);

            case EAnimations.Highlight: return(Highlight);

            case EAnimations.Spark: return(Spark);

            case EAnimations.Transform: return(Transform);
            }

            return(null);
        }
Пример #5
0
 protected static CAnimation Req(EAnimations type, Vector3 position)
 {
     return(Instance.Require(type, position));
 }