Exemplo n.º 1
0
    public void EffectAnimation(Character target)
    {
        SkillAnimation skillAnimation = Instantiate(sAnimationPrefab);

        skillAnimation.transform.SetParent(FindObjectOfType <Canvas>().transform, false);
        skillAnimation.PlayAnimation(this, target);
    }
Exemplo n.º 2
0
    private void UpdateAnimation()
    {
        SkillAnimation skillAnimation = _animtaionObject.GetComponent <SkillAnimation>();

        if (skillAnimation != null)
        {
            if (skillAnimation.flyOver)
            {
                _game.StartCoroutine(CreateBomb());

                _state = STATE.WORKING;
            }
        }
    }
Exemplo n.º 3
0
 public void RemoveSkillAnimation(SkillAnimation anim)
 {
     if (anim.clip != null)
     {
         RemoveAnimation(anim.clip);
     }
     if (anim.castAnimation.clip != null)
     {
         RemoveAnimation(anim.castAnimation.clip);
     }
     if (anim.followThroughAnimation.clip != null)
     {
         RemoveAnimation(anim.followThroughAnimation.clip);
     }
 }
Exemplo n.º 4
0
 public void TransferSkillAnimation(SkillAnimation anim)
 {
     if (anim.clip != null)
     {
         StartCoroutine(TransferAnimation(anim));
     }
     if (anim.castAnimation.clip != null)
     {
         StartCoroutine(TransferAnimation(anim.castAnimation));
     }
     if (anim.followThroughAnimation.clip != null)
     {
         StartCoroutine(TransferAnimation(anim.followThroughAnimation));
     }
 }
Exemplo n.º 5
0
    void Awake()
    {
        unitBg = GetComponent <Image>();

        int childCount = transform.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform child = transform.GetChild(i);
            if (child.name.Equals("Name"))
            {
                nameText = child.gameObject.GetComponent <Text>();
            }
            else if (child.name.Equals("Level"))
            {
                levelText = child.gameObject.GetComponent <Text>();
            }
            else if (child.name.Equals("HP"))
            {
                hpText = child.gameObject.GetComponent <Text>();
            }
            else if (child.name.Equals("HPSlider"))
            {
                hpSlider = child.gameObject.GetComponent <Slider>();
            }
            else if (child.name.Equals("MPSlider"))
            {
                mpSlider = child.gameObject.GetComponent <Slider>();
            }
            else if (child.name.Equals("TurnCount"))
            {
                turnCount = child.gameObject.GetComponent <Slider>();
            }
            else if (child.name.Equals("Image"))
            {
                image = child.gameObject.GetComponent <Image>();
            }
            else if (child.name.Equals("SkillAnimation"))
            {
                skillAnimation = child.gameObject.GetComponent <SkillAnimation>();
            }
            else if (child.name.Equals("DamageLog"))
            {
                damageLog = child.gameObject.GetComponent <DamageLogText>();
            }
            statusEffects = transform.GetComponentInChildren <StatusEffectsHUD>();
        }
    }
Exemplo n.º 6
0
    // Play the animation based on the SkillAnimation type
    public void play(SkillAnimation animation)
    {
        string animation_name = "idle";

        if (animation == SkillAnimation.ATTACK_NORMAL)
        {
            animation_name = "attack";
        }
        else if (animation == SkillAnimation.MAGIC_TARGET)
        {
            animation_name = "magic_target";
        }
        else
        {
            Debug.Log("The unit " + universal.name + " requested a non existent animation to be player " + animation);
        }

        GetComponent <Animator>().Play(animation_name);
    }
Exemplo n.º 7
0
	public void TransferSkillAnimation(SkillAnimation anim)
	{
		if(baseSkillAnimation.precastAnimation.clip != null)
		{
			AddAnimation(baseSkillAnimation.precastAnimation);
		}
		if(baseSkillAnimation.castAnimation.clip != null)
		{
			AddAnimation(baseSkillAnimation.castAnimation);
		}
		if(baseSkillAnimation.followThroughAnimation.clip != null)
		{
			AddAnimation(baseSkillAnimation.followThroughAnimation);
		}
		if(baseSkillAnimation.loopAnimation.clip != null)
		{
			AddAnimation(baseSkillAnimation.loopAnimation);
		}
	}
Exemplo n.º 8
0
    void Awake()
    {
        int childCount = transform.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform c = transform.GetChild(i);
            if (c.name.Equals("Image"))
            {
                image = c.gameObject.GetComponent <Image>();
            }
            else if (c.name.Equals("SkillAnimation"))
            {
                skillAnimation = c.gameObject.GetComponent <SkillAnimation>();
            }
            else if (c.name.Equals("DamageLog"))
            {
                damageLog = c.gameObject.GetComponent <DamageLogText>();
            }
            statusEffects = transform.GetComponentInChildren <StatusEffectsHUD>();
        }
    }
 void Awake()
 {
     FSM            = new FiniteStateMachine <SkillController>();
     skillAnimation = this.transform.GetChild(0).GetComponent <SkillAnimation>();
 }
Exemplo n.º 10
0
 public void RunAnimation(SkillAnimation animation)
 {
     anims.Add(animation, Time.time + animation.GetLength());
     animation.Animate();
 }
Exemplo n.º 11
0
 void Awake()
 {
     FSM = new FiniteStateMachine<SkillController>();
     skillAnimation = this.transform.GetChild(0).GetComponent<SkillAnimation>();
 }
Exemplo n.º 12
0
 public void TransferSkillAnimation(SkillAnimation anim)
 {
     if(anim.clip != null)
         StartCoroutine(TransferAnimation(anim));
     if(anim.castAnimation.clip != null)
         StartCoroutine(TransferAnimation(anim.castAnimation));
     if(anim.followThroughAnimation.clip != null)
         StartCoroutine(TransferAnimation(anim.followThroughAnimation));
 }
Exemplo n.º 13
0
 public void RemoveSkillAnimation(SkillAnimation anim)
 {
     if(anim.clip != null)
         RemoveAnimation(anim.clip);
     if(anim.castAnimation.clip != null)
         RemoveAnimation(anim.castAnimation.clip);
     if(anim.followThroughAnimation.clip != null)
         RemoveAnimation(anim.followThroughAnimation.clip);
 }
Exemplo n.º 14
0
	public void PlayerDamage( SkillAnimation _SkillAnim , UnitData _DefenderUnitData )
	{
		Debug.Log( "PlayerDamage()" ) ;
		if( null == _SkillAnim || 
		   null == _DefenderUnitData )
		{
			return ;
		}
		
		int hpNow = 0 ;
		Dictionary< string , StandardParameter > standardParamTable = 
			_DefenderUnitData.m_UnitDataStruct.GetStandardParameterTable() ;			
		if( true == standardParamTable.ContainsKey( "HP" ) )
		{
			hpNow = (int)standardParamTable[ "HP" ].now ;
		}
		
		bool IsDamageToHP = false ;		
		int totalDamagetoHP = 0 ;
		EnegyProperty attactProperty = _SkillAnim.m_SkillVariable.m_SkillPropertyNow.AttackProperty ;
		EnegyProperty defenseProperty = _DefenderUnitData.m_UnitDataStruct.DefenseProperty ;
		Debug.Log( "_Attacker.attacktSkillProperty=" + attactProperty.CreatePropertyString() ) ;
		Debug.Log( "_Defender.defenseProperty=" + defenseProperty.CreatePropertyString() ) ;
		
		string [] keys = attactProperty.GetKeys() ;
		for( int i = 0 ; i < keys.Length ; ++i )
		{
			int attackPower = attactProperty.GetProperty( keys[ 0 ] ) ;
			Debug.Log( "attackPower" + attackPower ) ;
			int attckPowerRemain = 
				defenseProperty.AddPropertyToArmor( keys[ 0 ] , -attackPower ) ;
			
			Debug.Log( "attckPowerRemain=" + attckPowerRemain ) ;
			attactProperty.AssignProperty( keys[ 0 ] , attckPowerRemain ) ;
			
			Debug.Log( "_Attacker.AttackProperty for " + keys[ 0 ] + " = " + 
			          attactProperty.GetProperty( keys[ 0 ] ) ) ;
			Debug.Log( "_Defender.DefenseProperty for " + keys[ 0 ] + " = " + 
						defenseProperty.GetProperty( keys[ 0 ] ) ) ;
			
			if( attckPowerRemain > 0 )
			{
				IsDamageToHP = true ;
				int damageToHP = attckPowerRemain ;
				
				if( true == standardParamTable.ContainsKey( "HP" ) )
				{
					hpNow = (int)standardParamTable[ "HP" ].now ;
					if( hpNow > attckPowerRemain )
					{
						hpNow -= damageToHP ;
						totalDamagetoHP += damageToHP ;
						attactProperty.AssignProperty( keys[ 0 ] , 0 ) ;
					}
					else
					{
						totalDamagetoHP += hpNow ;
						attckPowerRemain = attckPowerRemain - hpNow ;
						attactProperty.AssignProperty( keys[ 0 ] , attckPowerRemain ) ;
						hpNow = 0 ;
					}
						
					standardParamTable[ "HP" ].now = hpNow ;
				}
			}
			
		
		}
		
		FightSystem fs = GlobalSingleton.GetFightSystem() ;
		if( true == IsDamageToHP )
		{
			string str = string.Format( "{0} 對 {1} 造成了 {2} 點傷害" , 
			                           _SkillAnim.m_ParentName , 
			                           _DefenderUnitData.gameObject.name , 
			                           totalDamagetoHP ) ;
			fs.AddStatus( str ) ;
			str = string.Format( "{0} 剩下 {1} 點生命值" , _DefenderUnitData.gameObject.name , hpNow ) ;
			fs.AddStatus( str ) ;	
		}
		else
		{
			string str = string.Format( "{0} 對 {1} 沒有造成傷害" , 
			                           _SkillAnim.m_ParentName , 
			                           _DefenderUnitData.gameObject.name ) ;
			fs.AddStatus( str ) ;
		}
			
	}