Esempio n. 1
0
    public override void addCharacterAttr()
    {
        BaseAttr       baseAttr = FactoryManager.AttrFactory.getBaseAttr(mType);
        ICharacterAttr attr     = new ICharacterAttr(new SoldierAttrStrategy(), mLv, baseAttr);

        mCharacter.Attr = attr;
    }
Esempio n. 2
0
        public virtual void SetCharacterAttr(ICharacterAttr CharacterAttr)
        {
            m_Attribute = CharacterAttr;
            m_Attribute.InitAttr();

            m_NavmeshAgent.speed = m_Attribute.GetMoveSpeed();

            m_Name = m_Attribute.GetAttrName();
        }
Esempio n. 3
0
    public Collider2D currentTarget; //当前追逐或者攻击的目标

    public FireSlime(GameObject myBody, CharacterAI AI, ICharacterAttr attr, GameObject fusedLaser) : base(myBody, AI, attr)
    {
        SetFusedLaser(fusedLaser);
        if (myBody.GetComponent <FireSlimeBody>() == null)
        {
            Debug.Log("实例为空" + myBody.name);
        }
        myBody.GetComponent <FireSlimeBody>().SetCharacter(this);
    }
	// 取得減傷害值
	public override int GetDmgDescValue( ICharacterAttr CharacterAttr )
	{
		// 是否為士兵類別
		SoldierAttr theSoldierAttr = CharacterAttr as SoldierAttr;
		if(theSoldierAttr==null)
			return 0;

		// 回傳減傷值
		return (theSoldierAttr.GetSoldierLv()-1)*2;;
	}
Esempio n. 5
0
    public Collider2D currentTarget; //当前追逐或者攻击的目标

    public FireSlime1(GameObject myBody, CharacterAI AI, ICharacterAttr attr, GameObject meltedBomb) : base(myBody, AI, attr)
    {
        SetMeltedBomb(meltedBomb);
        if (myBody.GetComponent <FireSlime1Body>() == null)
        {
            Debug.Log("实例为空" + myBody.name);
            myBody.GetComponent <FireSlime1Body>().SetOwner(this);
        }
        myBody.GetComponent <FireSlime1Body>().SetOwner(this);
    }
Esempio n. 6
0
    public SoldierCaptive(IEnemy enemy)
    {
        mEnemy = enemy;

        ICharacterAttr attr = new ICharacterAttr(mEnemy.Attr.Strategy, 1, mEnemy.Attr.BaseAttr);

        this.Attr = attr;

        this.GameObject = mEnemy.GameObject;
        this.Weapon     = mEnemy.Weapon;
    }
Esempio n. 7
0
        public override int GetDmgDescValue(ICharacterAttr CharacterAttr)
        {
            SoldierAttr theSoldierAttr = CharacterAttr as SoldierAttr;

            if (theSoldierAttr == null)
            {
                return(0);
            }

            return((theSoldierAttr.GetSoldierLv() - 1) * 2);
        }
Esempio n. 8
0
    // 设定角色数值
    public virtual void SetCharacterAttr(ICharacterAttr CharacterAttr)
    {
        // 设定
        m_Attribute = CharacterAttr;
        m_Attribute.InitAttr();

        // 设定移动速度
        m_NavAgent.speed = m_Attribute.GetMoveSpeed();

        // 名称
        m_Name = m_Attribute.GetAttrName();
    }
Esempio n. 9
0
    //public virtual void SetCharacterAI(ICharacter )

    //设置角色属性
    public virtual void SetCharacterAttr(ICharacterAttr _characterAttr)
    {
        //设置
        attribute = _characterAttr;
        attribute.InitAttr();

        //设置移动速度
        navAgent.speed = attribute.GetMoveSpeed();

        //名称
        name = attribute.GetAttrName();
    }
    // 設定角色數值
    public virtual void SetCharacterAttr(ICharacterAttr CharacterAttr)
    {
        // 設定
        m_Attribute = CharacterAttr;
        m_Attribute.InitAttr();

        // 設定移動速度
        m_NavAgent.speed = m_Attribute.GetMoveSpeed();
        //Debug.Log ("設定移動速度:"+m_NavAgent.speed);

        // 名稱
        m_Name = m_Attribute.GetAttrName();
    }
Esempio n. 11
0
    protected ICharacterAttr m_Attribute = null; //角色属性



    //设置角色属性
    public virtual void SetCharacterAttr(ICharacterAttr CharacterAttr)
    {
        //设置
        m_Attribute = CharacterAttr;
        m_Attribute.InitAttr();

        //设置移动速度
        m_NavAgent.speed = m_Attribute.GetMoveSpeed();
        //Debug.Log("设置移动速度:"+m_NavAgent.speed);


        //名字
        m_Name = m_Attribute.GetAttrName();
    }
Esempio n. 12
0
    //属性初始化
    public override void initAttr(ICharacterAttr characterAttr)
    {
        SoldierAttr soldierAttr = characterAttr as SoldierAttr;

        if (soldierAttr == null) //需要判断参数是否是士兵属性
        {
            return;
        }

        //等级加HP上限
        if (soldierAttr.Lv > 0)
        {
            soldierAttr.addMaxHp((soldierAttr.Lv - 1) * 10);
        }
    }
	// 攻擊加乘
	public override int GetAtkPlusValue( ICharacterAttr CharacterAttr )
	{
		// 是否為敵方數值
		EnemyAttr theEnemyAttr = CharacterAttr as EnemyAttr;
		if(theEnemyAttr==null)
			return 0;

		// 依爆擊機率回傳攻擊加乘值
		int RandValue =  UnityEngine.Random.Range(0,100);
		if( theEnemyAttr.GetCritRate()  >= RandValue )
		{
			theEnemyAttr.CutdownCritRate();		// 減少爆擊機率
			return theEnemyAttr.GetMaxHP()*5; 	// 血量的5倍值
		}
		return 0;
	}
	// 初始的數值
	public override void InitAttr( ICharacterAttr CharacterAttr )
	{
		// 是否為士兵類別
		SoldierAttr theSoldierAttr = CharacterAttr as SoldierAttr;
		if(theSoldierAttr==null)
			return ;

		// 最大生命力有等級加乘
		int AddMaxHP = 0;
		int Lv = theSoldierAttr.GetSoldierLv();
		if(Lv > 0 )
			AddMaxHP = (Lv-1)*2;
	
		// 設定最高HP
		theSoldierAttr.AddMaxHP( AddMaxHP );
	}
Esempio n. 15
0
    public override void AddCharacterAttr()
    {
        //string name = "";
        //int maxHP = 0;
        //float moveSpeed = 0;
        //string iconSprite = "";
        //string prefabName = "";

        //if (mType == typeof(SoldierCaptain))
        //{
        //    name = "上尉军官";
        //    maxHP = 100;
        //    moveSpeed = 3;
        //    iconSprite = "CaptainIcon";
        //    mPrefabName = "Soldier1";
        //}
        //else if (mType == typeof(SoldierSergeant))
        //{
        //    name = "中士士兵";
        //    maxHP = 90;
        //    moveSpeed = 3;
        //    iconSprite = "SergeantIcon";
        //    mPrefabName = "Soldier3";

        //}
        //else if (mType == typeof(SoldierRookie))
        //{
        //    name = "新手士兵";
        //    maxHP = 80;
        //    moveSpeed = 2.5f;
        //    iconSprite = "RookieIcon";
        //    mPrefabName = "Soldier2";
        //}
        //else
        //{
        //    Debug.LogError("类型" + mType + "不属于ISoldier,无法创建战士");
        //}

        //ICharacterAttr attr = new ICharacterAttr(new SoldierAtrrStrategy(), mLv, name, maxHP, moveSpeed, iconSprite, prefabName);
        CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mType);

        mPrefabName = baseAttr.prefabName;
        ICharacterAttr attr = new ICharacterAttr(new SoldierAtrrStrategy(), mLv, baseAttr);

        mCharacter.attr = attr;
    }
Esempio n. 16
0
    public override void AddCharacterAttr()
    {
        //string name = "";
        //int maxHP = 0;
        //float moveSpeed = 0;
        //string iconSprite = "";

        //if (mType == typeof(EnemyElf))
        //{
        //    name = "小精灵";
        //    maxHP = 100;
        //    moveSpeed = 3;
        //    iconSprite = "ElfIcon";
        //    mPrefabName = "Enemy1";
        //}
        //else if (mType == typeof(EnemyOgre))
        //{
        //    name = "怪物";
        //    maxHP = 120;
        //    moveSpeed = 4;
        //    iconSprite = "OgreIcon";
        //    mPrefabName = "Enemy2";

        //}
        //else if (mType == typeof(EnemyTroll))
        //{
        //    name = "巨魔";
        //    maxHP = 200;
        //    moveSpeed = 1f;
        //    iconSprite = "TrollIcon";
        //    mPrefabName = "Enemy3";
        //}
        //else
        //{
        //    Debug.LogError("类型" + mType + "不属于IEnemy,无法创建战士");
        //}

        //ICharacterAttr attr = new ICharacterAttr(new SoldierAtrrStrategy(), mLv, name, maxHP, moveSpeed, iconSprite, mPrefabName);
        CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mType);

        mPrefabName = baseAttr.prefabName;
        ICharacterAttr attr = new ICharacterAttr(new EnemyAttrStrategy(), mLv, baseAttr);

        mCharacter.attr = attr;
    }
Esempio n. 17
0
        public override int GetAtkPlusValue(ICharacterAttr CharacterAttr)
        {
            EnemyAttr theEnemyAttr = CharacterAttr as EnemyAttr;

            if (theEnemyAttr == null)
            {
                return(0);
            }

            int RandValue = UnityEngine.Random.Range(0, 100);

            if (theEnemyAttr.GetCritRate() >= RandValue)
            {
                theEnemyAttr.CutdownCritRate();
                return(theEnemyAttr.GetMaxHP() * 5);
            }

            return(0);
        }
Esempio n. 18
0
        public override void InitAttr(ICharacterAttr CharacterAttr)
        {
            SoldierAttr theSoldierAttr = CharacterAttr as SoldierAttr;

            if (theSoldierAttr == null)
            {
                return;
            }

            int AddMaxHP = 0;
            int Lv       = theSoldierAttr.GetSoldierLv();

            if (Lv > 0)
            {
                AddMaxHP = (Lv - 1) * 2;
            }

            theSoldierAttr.AddMaxHP(AddMaxHP);
        }
Esempio n. 19
0
    //攻击加成
    public override int GetAtkPlusValue(ICharacterAttr CharacterAttr)
    {
        //是否为敌方属性
        EnemyAttr theEnemyAttr = CharacterAttr as EnemyAttr;

        if (theEnemyAttr == null)
        {
            return(0);
        }

        //按爆率返回攻击加成值
        int RandValue = UnityEngine.Random.Range(0, 100);

        if (theEnemyAttr.GetCritRate() >= RandValue)
        {
            theEnemyAttr.CutdownCritRate();      //减少暴击概率
            return(theEnemyAttr.GetMaxHP() * 5); //血量的5倍值
        }
        return(0);
    }
Esempio n. 20
0
    // 攻擊加乘
    public override int GetAtkPlusValue(ICharacterAttr CharacterAttr)
    {
        // 是否為敵方數值
        EnemyAttr theEnemyAttr = CharacterAttr as EnemyAttr;

        if (theEnemyAttr == null)
        {
            return(0);
        }

        // 依爆擊機率回傳攻擊加乘值
        int RandValue = UnityEngine.Random.Range(0, 100);

        if (theEnemyAttr.GetCritRate() >= RandValue)
        {
            theEnemyAttr.CutdownCritRate();                 // 減少爆擊機率
            return(theEnemyAttr.GetMaxHP() * 5);            // 血量的5倍值
        }
        return(0);
    }
Esempio n. 21
0
    public override void InitAttr(ICharacterAttr _characterAttr)
    {
        SoldierAttr theSoldierAttr = _characterAttr as SoldierAttr;

        if (theSoldierAttr == null)
        {
            return;
        }

        //最大生命力有等级加成
        int addMaxHP = 0;
        int lv       = theSoldierAttr.GetSoldierLv();

        if (lv > 0)
        {
            addMaxHP = (lv - 1) * 2;
        }

        //设置最高HP
        theSoldierAttr.AddMaxHP(addMaxHP);
    }
Esempio n. 22
0
    public override void InitAttr(ICharacterAttr CharacterAttr)
    {
        //是否为士兵类
        SoldierAttr theSoldierAttr = CharacterAttr as SoldierAttr;

        if (theSoldierAttr == null)
        {
            return;
        }

        //最大生命力有等级加成
        int AddMaxHP = 0;
        int Lv       = theSoldierAttr.GetSoldierLv();

        if (Lv > 0)
        {
            AddMaxHP = (Lv - 1) * 2;
        }

        //设置最高HP
        theSoldierAttr.AddMaxHP(AddMaxHP);
    }
Esempio n. 23
0
 public override int GetDmgDescValue(ICharacterAttr CharacterAttr)
 {
     return(0);
 }
	// 攻擊加乘
	public override int GetAtkPlusValue( ICharacterAttr CharacterAttr )
	{
		// 沒有攻擊加乘
		return 0;
	}
Esempio n. 25
0
	// 設定角色數值
	public virtual void SetCharacterAttr( ICharacterAttr CharacterAttr)
	{
		// 設定
		m_Attribute = CharacterAttr;
		m_Attribute.InitAttr ();

		// 設定移動速度
		m_NavAgent.speed = m_Attribute.GetMoveSpeed();
		//Debug.Log ("設定移動速度:"+m_NavAgent.speed);

		// 名稱
		m_Name = m_Attribute.GetAttrName();
	}
Esempio n. 26
0
 // 取得減傷害值
 public abstract int GetDmgDescValue(ICharacterAttr CharacterAttr);
	// 取得減傷害值
	public override int GetDmgDescValue( ICharacterAttr CharacterAttr )
	{
		// 沒有減傷
		return 0;
	}
Esempio n. 28
0
	// 取得減傷害值
	public abstract int GetDmgDescValue( ICharacterAttr CharacterAttr );
Esempio n. 29
0
	// 攻擊加乘
	public abstract int GetAtkPlusValue( ICharacterAttr CharacterAttr );
Esempio n. 30
0
 public override void initAttr(ICharacterAttr characterAttr)
 {
 }
Esempio n. 31
0
    /// <summary>
    /// 设置角色数值
    /// </summary>
    /// <param name="CharacterAttr"></param>
    public virtual void SetCharacterAttr(ICharacterAttr attr)
    {
        m_Attribute = attr;

        m_Attribute.InitAttr();
    }
Esempio n. 32
0
    public Collider2D currentTarget; //当前追逐或者攻击的目标

    public IceSlime2(GameObject myBody, CharacterAI AI, ICharacterAttr attr, GameObject iceLaser) : base(myBody, AI, attr)
    {
        SetIceLaser(iceLaser);
        myBody.GetComponent <IceSlime2Body>().SetCharacter(this);
    }
Esempio n. 33
0
    public Collider2D currentTarget; //当前追逐或者攻击的目标

    public FireSlime2(GameObject myBody, CharacterAI AI, ICharacterAttr attr, GameObject fire, GameObject rushFire) : base(myBody, AI, attr)
    {
        SetFire(fire);
        SetRushFire(rushFire);
        myBody.GetComponent <FireSlime2Body>().SetOwner(this);
    }
Esempio n. 34
0
 public override void InitAttr(ICharacterAttr CharacterAttr)
 {
 }
	// 初始的數值
	public override void InitAttr( ICharacterAttr CharacterAttr )
	{
		// 不用計算
	}
Esempio n. 36
0
	// 初始的數值
	public abstract void InitAttr( ICharacterAttr CharacterAttr );
Esempio n. 37
0
 // 攻擊加乘
 public abstract int GetAtkPlusValue(ICharacterAttr CharacterAttr);
Esempio n. 38
0
 public override void InitAttr(ICharacterAttr _characterAttr)
 {
     //不用计算
 }
Esempio n. 39
0
 // 初始的數值
 public abstract void InitAttr(ICharacterAttr CharacterAttr);
Esempio n. 40
0
 public override int GetAtkPlusValue(ICharacterAttr CharacterAttr)
 {
     return(0);
 }