public override bool Play(BattleCard target) { m_TargetCard = target; if (m_EffectLib == null) { Debug.LogError("Can't play effect! " + m_EffectName); if (EffectEnd != null) { EffectEnd(this, m_TargetCard, 0f); } return(false); } GameObject go = GameObject.Instantiate(m_EffectLib) as GameObject; Vector3 _localScale = go.transform.localScale * m_StartPos.localScale.x; go.transform.parent = m_StartPos.parent; Vector3 pos = new Vector3(0.0f, 0.0f, -30.0f); pos.x = m_StartPos.localPosition.x; pos.y = m_StartPos.localPosition.y; go.transform.localPosition = pos; go.transform.localScale = _localScale;//new Vector3(512.0f, 512.0f, 0.0f); //计算旋转方向 Vector3 direct = m_DirectionPoint - m_StartPos.transform.localPosition; if (direct.x != 0f || direct.y != 0f) { direct.z = 0f; go.transform.up = direct; } //如果速度不为0,则特效需要飞行,添加iTween事件 if (m_MoveSpeed > 0f) { go.AddComponent <iTweenHandler>().ProjectileFlyCompleteHandler = ProjectileFlyCompleteHandler; Hashtable args = new Hashtable(); args.Add("time", m_MoveSpeed); args.Add("x", m_StartPos.position.x); args.Add("y", m_StartPos.position.y); args.Add("looptype", iTween.LoopType.none); args.Add("easetype", iTween.EaseType.linear); args.Add("oncompletetarget", go); args.Add("oncompleteparams", go); args.Add("oncomplete", "OnProjectileFlyComplete"); iTween.MoveTo(go, args); } DestroyParticle dp = go.AddComponent <DestroyParticle>(); dp.particleCompleteDelegate += AnimationCompleteHandler; dp.DestroyTime = 1000f; m_EffectObj = go; return(true); }
public static DestroyParticle AddComponent(GameObject go, int onhit_time, int destroy_time) { DestroyParticle dp = go.AddComponent <DestroyParticle>(); dp.OnhitTime = onhit_time; dp.DestroyTime = destroy_time; return(dp); }
public void Initialize() { size = new Point(320, 160); position = new Vector2(Screen.Width / 2 - size.X / 2, Screen.Height / 2 - size.Y / 2); healParticle = new HealParticle(name, position, size, 20, false); destroyParticle = null; breakTimer = new Timer(1f); Initialized = true; }
public void Update(GameTime gameTime) { if (healParticle.IsDead) { breakTimer.Update(gameTime); } if (breakTimer.IsTime && destroyParticle == null) { destroyParticle = new DestroyParticle(name, position, size, DestroyParticle.DestroyOption.Center, 10, false); Initialized = false; } }
private void PlayBehitAnimParticle() { if (m_BehitParticle == null) { Debug.LogError("Can not find res " + m_SkillDisplayTab.BehitAnim); for (int i = 0; i < m_TargetList.Count; i++) { m_TargetList[i].AnimateBeHit(m_BehitMap[m_TargetList[i]]); m_TargetList[i].ShowHitValue(m_BehitMap[m_TargetList[i]], this, false); m_TargetList[i].OnHit(m_SkillOwner, m_BehitMap[m_TargetList[i]]); } return; } GameObject go = null; go = GameObject.Instantiate(m_BehitParticle) as GameObject; go.transform.parent = null; if (m_SkillOwner.Card_Type == BattleCardType.E_BATTLE_CARD_TYPE_SELF) { go.transform.position = new Vector3(0f, 0f, -2f); } else { if (m_SkillDisplayTab.BehitAnimSelf != "-1") { go.transform.position = new Vector3(0f, 0f, -2f); } else { go.transform.position = new Vector3(0f, -1f, -2f); } } DestroyParticle dp = DestroyParticle.AddComponent(go, m_SkillDisplayTab.NumDelay, m_SkillDisplayTab.BehitAnimTime); dp.particleCompleteDelegate = BehitParticleCompleteHandler; dp.skillOnhitDelegate = SkillOnhtiHandler; }
public void NotifyParticleDestroy(IParticle particle) { var dp = new DestroyParticle(particle); _packetHandlerManager.BroadcastPacket(dp, Channel.CHL_S2C); }