Ejemplo n.º 1
0
    /// <summary>
    /// 激活行为.
    /// </summary>
    public override void Active()
    {
        isFinish      = false;
        beginPosition = hero.Position;
        if (null == target)
        {
            isFinish = true;
            return;
        }
        if (null != target)
        {
            endPosition = target.Position;
            hasTarget   = true;
        }
        hero.property.AutoAttack = true;
        action.beginPosition     = beginPosition;
        action.endPosition       = endPosition;
        action.speed             = hero.Speed;
        action.deltaSpace        = deltaSpace;
        action.Active();

        if (!action.IsFinish())
        {
            hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, hero.CharacterStateName(CharacterState.MOVE1));
            hero.Net.SendHeroMove(endPosition);
        }
        //hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, hero.CharacterStateName(CharacterState.MOVE1));
        //hero.Net.SendHeroMove(endPosition);
    }
Ejemplo n.º 2
0
	/// <summary>
	/// Update this instance.
	/// </summary>
	public override void Update()
	{
		if (null != hero.AnimCmp && !hero.AnimCmp.IsFighting() )
		{
			hero.property.fightHp = hero.property.hp;
		}
		
		action.speed = hero.Speed;
		action.isLock = isLock;
		action.deltaSpace = deltaSpace;
		action.Update();
        EventRet ret = hero.DispatchEvent(ControllerCommand.IsPlayingActionFinish, hero.CharacterStateName(CharacterState.MOVE1));
		float _time = action.speed / commonSpeed;
		if( hero.AnimCmp.IsSpeedStackEmpty() )
			hero.AnimCmp.SetSpeed(_time);
        bool b = (bool)ret.GetReturn<AnimationComponent>();
		if(b)
		{
			hero.DispatchEvent(ControllerCommand.CrossFadeAnimation,hero.CharacterStateName(CharacterState.MOVE1));
		}
		if(action.IsFinish())
		{
            hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, hero.CharacterStateName(CharacterState.IDLE1));
			return;
		}
		
	}
Ejemplo n.º 3
0
 public override void Update()
 {
     base.Update();
     if (isFinish)
     {
         return;
     }
     if (!actionMove.IsFinish())
     {
         actionMove.Update();
     }
     KeepActionPlay();
     if (ticker.IsActiveOneTime())
     {
         try
         {
             CheckShendPos(hero.Position);
             DestroyFx();
             hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, hero.CharacterStateName(CharacterState.IDLE1));
         }
         catch (System.Exception e)
         {
             Debug.Log(e.ToString());
         }
         PlayEndFx(5f);
         isFinish = true;
     }
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Update this instance.
    /// </summary>
    public override void Update()
    {
        if (ticker.IsEnable())
        {
            if (Vector3.Distance(endPosition, targetHero.Position) > 0.3f)
            {
                Active();
            }
        }
        if (action.IsFinish())
        {
            if (!isFinish)
            {
                if (null != targetHero)
                {
                    hero.DispatchEvent(ControllerCommand.REACH_NPC);
                    if (null != del)
                    {
                        hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, hero.CharacterStateName(CharacterState.IDLE1));
                        del(targetHero);
                    }
                }
                isFinish = true;
            }

            return;
        }
        action.speed      = speed;
        action.isLock     = isLock;
        action.deltaSpace = deltaSpace;
        action.Update();
        EventRet ret  = hero.DispatchEvent(ControllerCommand.IsPlayingActionFinish, hero.CharacterStateName(CharacterState.MOVE1));
        bool     bRet = (bool)ret.GetReturn <AnimationComponent>();

        if (bRet)
        {
            hero.DispatchEvent(ControllerCommand.CrossFadeAnimation, hero.CharacterStateName(CharacterState.MOVE1));
        }
    }