Пример #1
0
    private void Start()
    {
        mTransform = GameObject.transform;
        mRenderer  = GameObject.GetComponent <Renderer>();

        mAnimPosition           = new AnimVector3(Vector3.zero, Vector3.back * 2, 0.67f);
        mAnimPosition.EaseType  = AnimEasing.EaseType.EaseInOutBack;
        mAnimPosition.OnUpdate += OnUpdatePosition;

        mAnimRotation           = new AnimQuaternion(Quaternion.identity, Quaternion.identity, 0.5f);
        mAnimRotation.EaseType  = AnimEasing.EaseType.EaseOutCirc;
        mAnimRotation.OnUpdate += OnUpdateRotation;
        mAnimRotation.OnFinish += OnFinishRotation;

        mAnimColor           = new AnimColor(Color.red, Color.yellow, 2);
        mAnimColor.EaseType  = AnimEasing.EaseType.EaseInOutCirc;
        mAnimColor.OnUpdate += OnUpdateColor;
        mAnimColor.OnFinish += OnFinishColor;

        mAnimText           = new AnimString("", Messages[0], 2);
        mAnimText.EaseType  = AnimEasing.EaseType.EaseOutCubic;
        mAnimText.OnUpdate += OnUpdateText;
        mAnimText.OnFinish += OnFinishText;

        mCurrentMessageIndex++;
    }
Пример #2
0
        private void CleanUp()
        {
            AnimController animController = Service.Get <AnimController>();

            if (this.animAlphaIn != null)
            {
                animController.CompleteAnim(this.animAlphaIn);
                this.animAlphaIn = null;
            }
            if (this.animAlphaOut != null)
            {
                animController.CompleteAnim(this.animAlphaOut);
                this.animAlphaOut = null;
            }
            if (this.gameObject != null)
            {
                MeshFilter component = this.gameObject.GetComponent <MeshFilter>();
                component.sharedMesh = null;
            }
            if (this.mesh != null)
            {
                UnityUtils.DestroyMesh(this.mesh);
                this.mesh = null;
            }
            if (this.gameObjectExists)
            {
                this.gameObject.SetActive(false);
                this.gameObjectExists = false;
            }
            this.gameObjectVisible = false;
            this.initialized       = false;
        }
Пример #3
0
        private void CreateSpawnGameObject()
        {
            MeshRenderer meshRenderer;
            MeshFilter   meshFilter;

            if (this.gameObject == null)
            {
                this.gameObject = new GameObject("SpawnProtectionView");
                meshRenderer    = this.gameObject.AddComponent <MeshRenderer>();
                meshFilter      = this.gameObject.AddComponent <MeshFilter>();
            }
            else
            {
                meshRenderer = this.gameObject.GetComponent <MeshRenderer>();
                meshFilter   = this.gameObject.GetComponent <MeshFilter>();
            }
            this.gameObject.SetActive(false);
            this.gameObject.transform.position = new Vector3(0f, 0.045f, 0f);
            this.gameObjectExists  = true;
            this.gameObjectVisible = false;
            meshFilter.sharedMesh  = this.mesh;
            if (this.material == null)
            {
                string shaderName = "Grid_Protection_PL";
                Shader shader     = Service.Get <AssetManager>().Shaders.GetShader(shaderName);
                if (shader == null)
                {
                    return;
                }
                this.material = UnityUtils.CreateMaterial(shader);
                meshRenderer.GetComponent <Renderer>().sharedMaterial = this.material;
                if (this.texture != null)
                {
                    this.material.mainTexture = this.texture;
                }
                else if (this.textureHandle == AssetHandle.Invalid)
                {
                    TextureVO textureVO = Service.Get <IDataController>().Get <TextureVO>("textureSpawnProtection1");
                    Service.Get <AssetManager>().Load(ref this.textureHandle, textureVO.AssetName, new AssetSuccessDelegate(this.OnTextureLoaded), null, null);
                }
            }
            this.material.SetFloat("_Speed", 0.4f);
            this.material.color                  = Color.black;
            this.animAlphaIn                     = new AnimColor(this.material, 1f, Color.black, Color.white);
            this.animAlphaIn.EaseFunction        = new Easing.EasingDelegate(Easing.QuintEaseOut);
            this.animAlphaOut                    = new AnimColor(this.material, 1f, Color.white, Color.black);
            this.animAlphaOut.Delay              = 3f;
            this.animAlphaOut.EaseFunction       = new Easing.EasingDelegate(Easing.QuintEaseIn);
            this.animAlphaOut.OnCompleteCallback = new Action <Anim>(this.OnAlphaOutComplete);
        }
Пример #4
0
    private void Start()
    {
        mTransform = GameObject.transform;
        mRenderer = GameObject.GetComponent<Renderer>();

        mAnimPosition = new AnimVector3(Vector3.zero, Vector3.back * 2, 0.67f);
        mAnimPosition.EaseType = AnimEasing.EaseType.EaseInOutBack;
        mAnimPosition.OnUpdate += OnUpdatePosition;

        mAnimRotation = new AnimQuaternion(Quaternion.identity, Quaternion.identity, 0.5f);
        mAnimRotation.EaseType = AnimEasing.EaseType.EaseOutCirc;
        mAnimRotation.OnUpdate += OnUpdateRotation;
        mAnimRotation.OnFinish += OnFinishRotation;

        mAnimColor = new AnimColor(Color.red, Color.yellow, 2);
        mAnimColor.EaseType = AnimEasing.EaseType.EaseInOutCirc;
        mAnimColor.OnUpdate += OnUpdateColor;
        mAnimColor.OnFinish += OnFinishColor;

        mAnimText = new AnimString("", Messages[0], 2);
        mAnimText.EaseType = AnimEasing.EaseType.EaseOutCubic;
        mAnimText.OnUpdate += OnUpdateText;
        mAnimText.OnFinish += OnFinishText;

        mCurrentMessageIndex++;
    }