void End() { SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>(); Color color = render.color; color.a = 0.0f; }
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); }
void End() { SpriteRenderer render = TargetGameObject.GetComponent <SpriteRenderer>(); Color color = Color.white; render.color = color; }
public ButtonController(Xdk xdk, string gameObjectName, int index) : base(xdk, gameObjectName) { _index = index; if (TargetGameObject != null) { _meshRenderer = TargetGameObject.GetComponent <MeshRenderer>(); _normalColor = _meshRenderer.material.color; } }
//------------------------------------------------------------------------------- //------------------------------------------------------------------------------- //------------------------------------------------------------------------------- public void SetMaterial(Material value) { var psr = TargetGameObject?.GetComponent <ParticleSystemRenderer>(); if (psr) { psr.material = value; } }
void OnTriggerEnter2D(Collider2D collider) { //문제가 있음...Debug 요망 if (collider.gameObject.GetComponent <DocsaSakki>() != null) { ShooterGameObject.GetComponent <Hunter>().Behaviour.GrabDocsa(TargetGameObject.GetComponent <DocsaSakki>()); } Destroy(this.gameObject); }
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; } }
//------------------------------------------------------------------------------- private void WithMaterial(Action <Material> action) { var mat = TargetGameObject?.GetComponent <ParticleSystemRenderer>()?.material; if (mat) { action.Invoke(mat); } }
//------------------------------------------------------------------------------- // Sound //------------------------------------------------------------------------------- public void Snd_SetRolloffModeLogarithmic(bool isLogarithmic) { var cmp = TargetGameObject.GetComponent <AudioSource>(); if (cmp) { cmp.rolloffMode = isLogarithmic ? AudioRolloffMode.Logarithmic : AudioRolloffMode.Linear; } }
//------------------------------------------------------------------------------- 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; } }
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); } }
//------------------------------------------------------------------------------- // 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; } }
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)); } }
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; }
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(); } }
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(); } }
void ScaleColliderSize() { TargetGameObject.GetComponent <BoxCollider>().size = Toolkit.Mul(Vector3.one, TargetComponent.transform.localScale); }
public void Anim_Play() { TargetGameObject.GetComponent <Animation>()?.Play(); }
public void Anim_Play(string animationName) { TargetGameObject.GetComponent <Animation>()?.Play(animationName); }
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>(); }
//------------------------------------------------------------------------------- // Animation //------------------------------------------------------------------------------- public void Anim_Stop() { TargetGameObject.GetComponent <Animation>()?.Stop(); }