Exemplo n.º 1
0
    void End()
    {
        SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>();
        Color          color  = render.color;

        color.a = 0.0f;
    }
Exemplo n.º 2
0
    private void PrepareScript()
    {
        if (null == TargetGameObject)
        {
            TargetGameObject = GameObject.FindGameObjectWithTag(TargetTag);
            if (null == TargetGameObject)
            {
                this.enabled = false;
                return;
            }
        }

        mPlayerDirectionDispatcher = (IPlayerDirectionDispatcher)TargetGameObject.GetComponent(typeof(IPlayerDirectionDispatcher));

        if (null != mPlayerDirectionDispatcher)
        {
            mPlayerDirectionDispatcher.PlayerDirectionChanged += OnPlayerDirectionChanged;
        }

        if (null == mTransform)
        {
            mTransform = transform;
        }

        mDistanceFromTarget = DistanceFromTarget;

        mTargetOffset = Offset;

        mCentralizedPosition = GetTargetPosition();
        mTransform.position  = mCentralizedPosition;
        mTransform.LookAt(mTargetPosition);
        mTransform.Translate(mTargetOffset);
    }
Exemplo n.º 3
0
    void End()
    {
        SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>();
        Color          color  = Color.white;

        render.color = color;
    }
Exemplo n.º 4
0
 public ButtonController(Xdk xdk, string gameObjectName, int index) : base(xdk, gameObjectName)
 {
     _index = index;
     if (TargetGameObject != null)
     {
         _meshRenderer = TargetGameObject.GetComponent <MeshRenderer>();
         _normalColor  = _meshRenderer.material.color;
     }
 }
Exemplo n.º 5
0
        //-------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------

        public void SetMaterial(Material value)
        {
            var psr = TargetGameObject?.GetComponent <ParticleSystemRenderer>();

            if (psr)
            {
                psr.material = value;
            }
        }
Exemplo n.º 6
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     //문제가 있음...Debug 요망
     if (collider.gameObject.GetComponent <DocsaSakki>() != null)
     {
         ShooterGameObject.GetComponent <Hunter>().Behaviour.GrabDocsa(TargetGameObject.GetComponent <DocsaSakki>());
     }
     Destroy(this.gameObject);
 }
Exemplo n.º 7
0
 public LedController(Xdk xdk, string gameObjectName, int ledIndex) : base(xdk, gameObjectName)
 {
     _led = Xdk.Leds[ledIndex];
     if (TargetGameObject != null)
     {
         _meshRenderer = TargetGameObject.GetComponent <MeshRenderer>();
         _offColor     = _meshRenderer.material.color;
     }
 }
Exemplo n.º 8
0
        //-------------------------------------------------------------------------------

        private void WithMaterial(Action <Material> action)
        {
            var mat = TargetGameObject?.GetComponent <ParticleSystemRenderer>()?.material;

            if (mat)
            {
                action.Invoke(mat);
            }
        }
Exemplo n.º 9
0
        //-------------------------------------------------------------------------------
        // Sound
        //-------------------------------------------------------------------------------

        public void Snd_SetRolloffModeLogarithmic(bool isLogarithmic)
        {
            var cmp = TargetGameObject.GetComponent <AudioSource>();

            if (cmp)
            {
                cmp.rolloffMode = isLogarithmic ? AudioRolloffMode.Logarithmic : AudioRolloffMode.Linear;
            }
        }
Exemplo n.º 10
0
        //-------------------------------------------------------------------------------

        private void WithParticles(Action <ParticleSystem.MainModule> action)
        {
            var ps = TargetGameObject?.GetComponent <ParticleSystem>();

            if (ps)
            {
                action.Invoke(ps.main);
            }
        }
 private void UpdateTargetAnimation()
 {
     if (TargetGameObject != null)
     {
         RuntimeAnimation animation = TargetGameObject.GetComponent <RuntimeAnimation>();
         Target = animation;
     }
     else
     {
         Target = null;
     }
 }
Exemplo n.º 12
0
        public void Cmp_RemoveAsReference(MonoBehaviour reference)
        {
            if (reference == null)
            {
                Debug.LogError("[" + name + ".Cmp_RemoveAsReference]: Reference is null");
                return;
            }

            var cmp = TargetGameObject.GetComponent(reference.GetType());

            if (cmp)
            {
                Destroy(cmp);
            }
        }
Exemplo n.º 13
0
        //-------------------------------------------------------------------------------
        // Light
        //-------------------------------------------------------------------------------

        public void Lght_SetShadowType(int type)
        {
            var cmp = TargetGameObject.GetComponent <Light>();

            if (!cmp)
            {
                return;
            }

            switch (type)
            {
            case 0: cmp.shadows = LightShadows.None; break;

            case 1: cmp.shadows = LightShadows.Hard; break;

            case 2: cmp.shadows = LightShadows.Soft; break;
            }
        }
Exemplo n.º 14
0
    IEnumerator Fade()
    {
        //CDebugLog.Log(ELogType.Default, "Fade Function End");

        SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>();

        float i = 0;

        for (float f = 1f; f >= 0; f -= 0.1f)
        {
            Color c = render.color;
            c.a          = f;
            render.color = c;
            i            = f;
            CDebugLog.Log(ELogType.Default, i);
            yield return(new WaitForSeconds(.1f));
        }
    }
Exemplo n.º 15
0
        private void MR_SetMaterial(int index, Material material)
        {
            var cmp = TargetGameObject.GetComponent <MeshRenderer>();

            if (cmp == null)
            {
                return;
            }

            var materials = cmp.materials;

            if (index >= materials.Length)
            {
                return;
            }

            materials[index] = material;
            cmp.materials    = materials;
        }
Exemplo n.º 16
0
    public override void Update()
    {
        if (continueTime <= 0.0f)
        {
            return;
        }

        SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>();
        Color          color  = render.color;

        color.a     -= Time.fixedDeltaTime;
        color.a      = Mathf.Max(0.0f, color.a);
        render.color = color;

        continueTime -= Time.fixedDeltaTime;
        if (continueTime <= 0.0f)
        {
            End();
        }
    }
Exemplo n.º 17
0
    public override void Update()
    {
        if (continueTime <= 0.0f)
        {
            return;
        }

        float          preAttackElapsedtime = Time.fixedTime - startTime;
        float          plusAlpha            = preAttackElapsedtime * 0.3f / startTime;
        SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>();
        Color          color  = render.color;

        color.a      = 0.5f + plusAlpha;
        render.color = color;

        continueTime -= Time.fixedDeltaTime;
        if (continueTime <= 0.0f)
        {
            End();
        }
    }
Exemplo n.º 18
0
 void ScaleColliderSize()
 {
     TargetGameObject.GetComponent <BoxCollider>().size = Toolkit.Mul(Vector3.one, TargetComponent.transform.localScale);
 }
Exemplo n.º 19
0
 public void Anim_Play()
 {
     TargetGameObject.GetComponent <Animation>()?.Play();
 }
Exemplo n.º 20
0
 public void Anim_Play(string animationName)
 {
     TargetGameObject.GetComponent <Animation>()?.Play(animationName);
 }
Exemplo n.º 21
0
 protected MultiValueGaugeController(Xdk xdk, IEnumerable <Sprite> sprites, string spriteNamePattern, string gaugeObjectName) :
     base(xdk, sprites.Where(s => s.name.StartsWith(spriteNamePattern)).ToArray(), gaugeObjectName)
 {
     _gaugeImage = TargetGameObject.GetComponent <Image>();
 }
Exemplo n.º 22
0
        //-------------------------------------------------------------------------------
        // Animation
        //-------------------------------------------------------------------------------

        public void Anim_Stop()
        {
            TargetGameObject.GetComponent <Animation>()?.Stop();
        }