public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            MaterialChanger materialChanger = (MaterialChanger)target;

            if (GUILayout.Button("Change Material To Transparent"))
            {
                materialChanger.ChangeMaterial();
            }
        }
Esempio n. 2
0
        public void GenerateShadow(StatewithEffect stateEffect, Animator animator, AnimatorStateInfo stateInfo)
        {
            if (animator.IsInTransition(0))
            {
                return;
            }
            GameObject      shadowObj  = PoolManager.Instance.GetObject(PoolObjectType.Shadow);
            PoolObject      shadow     = shadowObj.GetComponent <PoolObject> ();
            MaterialChanger matChanger = shadowObj.GetComponent <MaterialChanger> ();

            CharacterControl player         = stateEffect.CharacterControl;
            Animator         shadowAnimator = shadowObj.GetComponentInChildren <Animator> ();

            shadowObj.SetActive(true);
            matChanger.TurnOffRenderers();

            shadowAnimator.Play(player.CharacterData.GetCurrState(), -1, stateInfo.normalizedTime);
            shadowAnimator.SetFloat(TransitionParameter.SpeedMultiplier.ToString(), 0f);
            shadow.WaitAndDestroy(ShadowDuration);
            matChanger.ChangeTransparency(ShadowDuration);
            shadowObj.transform.position = player.gameObject.transform.position;
            shadowObj.transform.rotation = player.gameObject.transform.rotation;
            matChanger.TurnOnRenderersDelay(0.05f);
        }