// 加入Troll單位 public IEnemy AddTroll(ENUM_Weapon emWeapon) { // 產生物件 EnemyTroll theEnmey = new EnemyTroll(); // 設定模型 GameObject tmpGameObject = CreateGameObject("TrollGameObjectName"); tmpGameObject.gameObject.name = "EnemyTroll"; theEnmey.SetGameObject(tmpGameObject); // 加入武器 IWeapon Weapon = CreateWeapon(emWeapon); theEnmey.SetWeapon(Weapon); // 取得Soldier的數值,設定給角色 EnemyAttr theEnemyAttr = CreateEnemyAttr(3); theEnmey.SetCharacterAttr(theEnemyAttr); // 加入AI EnemyAI theAI = CreateEnemyAI(); theEnmey.SetAI(theAI); // 加入管理器 //PBaseDefenseGame.Instance.AddEnemy( theEnmey as IEnemy ); return(theEnmey as IEnemy); }
// 加入Ogre单位 public IEnemy AddOgre(ENUM_Weapon emWeapon) { // 产生物件 EnemyOgre theEnmey = new EnemyOgre(); // 设定模型 GameObject tmpGameObject = CreateGameObject("OgreGameObjectName"); tmpGameObject.gameObject.name = "EnemyOgre"; theEnmey.SetGameObject(tmpGameObject); // 加入武器 IWeapon Weapon = CreateWeapon(emWeapon); theEnmey.SetWeapon(Weapon); // 取得Soldier的数值,设定给角色 EnemyAttr theEnemyAttr = CreateEnemyAttr(2); theEnmey.SetCharacterAttr(theEnemyAttr); // 加入AI EnemyAI theAI = CreateEnemyAI(); theEnmey.SetAI(theAI); // 加入管理器 //PBaseDefenseGame.Instance.AddEnemy( theEnmey as IEnemy ); return(theEnmey as IEnemy); }
// Start is called before the first frame update void Start() { massNum = 5; //boxCollider = GetComponent<BoxCollider2D>(); //print(boxCollider.ToString()); if (gameObject.tag.Contains("Slime")) { attributes = GetComponent <SlimeAttr>(); } if (gameObject.tag.Contains("Skeleton")) { attributes = GetComponent <SkeletonAttr>(); } if (gameObject.tag.Contains("Dio")) { attributes = GetComponent <DioAttr>(); } rb = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); rb.freezeRotation = true; //rb.mass = 300; //rb.gravityScale = 5; //print("loaded: " + attributes.name); if (attributes.name == "slime") { attributes.hp += (int)gameObject.transform.localScale.x; } }
public override CharacterAttr AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.AttrFactory.GetCharacterBaseAttr(t); EnemyAttr attr = new EnemyAttr(new SoldierAttrStrategy(), baseAttr, lv, baseAttr.CritRate); return(attr); }
private void SetCurrentEnemy(object obj) { object[] objs = obj as object[]; EnemyAttr attr = objs[0] as EnemyAttr; _view.SetCurrentEnemy(attr); }
public override void setCharacterAttr() { EnemyAttr enemyAttr = new EnemyAttr(); enemyAttr.setAttrStragegy(new EnemyAttrStrategy()); m_enemyBuildParam.character.CharacterAttr = enemyAttr; }
// 加入角色數值 public override void AddAttr(ICharacter pRole, int Lv) { // 取得Enemy的數值,設定給角色 EnemyAttr theEnemyAttr = CreateEnemyAttr(pRole.GetAttrID()); pRole.SetCharacterAttr(theEnemyAttr); }
public override void SetCharacterAttr() { IAttrFactory AttrFactory = RTSFactory.GetAttrFactory(); EnemyAttr theEnemyAttr = AttrFactory.GetEnemyAttr( m_BuildParam.NewCharacter.GetAttrID()); theEnemyAttr.SetAttrStrategy(new EnemyAttrStrategy()); m_BuildParam.NewCharacter.SetCharacterAttr(theEnemyAttr); }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.AttrFactory.GetCharacterBaseAttr(m_CharacterType); m_PrefabName = baseAttr.PrefabName; ICharacterAttr attr = new EnemyAttr(new EnemyAttrStategy(), m_LV, baseAttr); m_Character.Attr = attr; }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mT); mPrefabName = baseAttr.prefabName; ICharacterAttr attr = new EnemyAttr(new EnemyAttrStrategy(), mLv, baseAttr); mCharacter.attr = attr; }
public override void AddCharacterAttr() { CharacterBaseAttr enemyBaseAttr = FactoryManager.GetAttrFactory.GetCharacterBaseAttr(mT); mPrefabName = enemyBaseAttr.PrefabName;//下方添加角色需要prefabName; ICharacterAttr attr = new EnemyAttr(new EnemyAttrStrategy(), mLv, enemyBaseAttr); mCharacter.Attr = attr; }
public override EnemyAttr GetEnemyAttr(int AttrID) { if (m_EnemyAttrDB.ContainsKey(AttrID)) { EnemyAttr NewAttr = new EnemyAttr(); NewAttr.SetEnemyAttr(m_EnemyAttrDB[AttrID]); return(NewAttr); } Debug.LogWarning("GetEnemyAttr:AttrID[" + AttrID + "]不存在"); return(null); }
public override void SetCharacterAttr() { IAttrFactory theAttrFactory = GameFactory.GetAttrFactory(); int AttrID = m_BuildParam.NewCharacter.GetAttrID(); EnemyAttr theEnemyAttr = theAttrFactory.GetEnemyAttr(AttrID); theEnemyAttr.SetAttStrategy(new EnemyAttrStrategy()); m_BuildParam.NewCharacter.SetCharacterAttr(theEnemyAttr); }
// 设定角色能力 public override void SetCharacterAttr() { // 取得Enemy的数值 IAttrFactory theAttrFactory = PBDFactory.GetAttrFactory(); int AttrID = m_BuildParam.NewCharacter.GetAttrID(); EnemyAttr theEnemyAttr = theAttrFactory.GetEnemyAttr(AttrID); // 设定数值的计算策略 theEnemyAttr.SetAttStrategy(new EnemyAttrStrategy()); // 设定给角色 m_BuildParam.NewCharacter.SetCharacterAttr(theEnemyAttr); }
// 获取Enemy的属性,传入外部参数CritRate public override EnemyAttr GetEnemyAttr(int AttrID) { if (m_EnemyAttrDB.ContainsKey(AttrID) == false) { Debug.LogWarning("GetEnemyAttr:AttrID[" + AttrID + "]属性不存在"); return(null); } // 产生属性对象并设置共享的属性数据 EnemyAttr NewAttr = new EnemyAttr(); NewAttr.SetEnemyAttr(m_EnemyAttrDB[AttrID]); return(NewAttr); }
// 取得Enemy的数值,传入外部参数CritRate public override EnemyAttr GetEnemyAttr(int AttrID) { if (m_EnemyAttrDB.ContainsKey(AttrID) == false) { Debug.LogWarning("GetEnemyAttr:AttrID[" + AttrID + "]数值不存在"); return(null); } // 产生数物件并设定共用的数值资料 EnemyAttr NewAttr = new EnemyAttr(); NewAttr.SetEnemyAttr(m_EnemyAttrDB[AttrID]); return(NewAttr); }
public void SetCurrentEnemy(EnemyAttr attr) { if (attr != null) { currentSlider.maxValue = attr.GetMaxHP(); currentSlider.value = attr.GetNowHP(); if (currentSlider.value == 0) { IUserInterfaceManager.GetInstance().CloseUI(typeof(BloodUIConfig)); } return; } Debug.LogError("EnemyAttr异常!!!"); }
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); }
// public EnemyCaptive( ISoldier theSoldier, Vector3 AttackPos) { m_emEnemyType = ENUM_Enemy.Catpive; m_Captive = theSoldier; // 設定成像 SetGameObject( theSoldier.GetGameObject() ); // 將Soldier數值轉成Enemy用的 EnemyAttr tempAttr = new EnemyAttr(); SetCharacterAttr( tempAttr ); // 設定武器 SetWeapon( theSoldier.GetWeapon() ); // 更改為SoldierAI m_AI = new EnemyAI( this, AttackPos ); m_AI.ChangeAIState( new IdleAIState() ); }
//攻击加成 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 EnemyCaptive(ISoldier theSoldier, Vector3 AttackPos) { m_emEnemyType = ENUM_Enemy.Catpive; m_Captive = theSoldier; // 設定成像 SetGameObject(theSoldier.GetGameObject()); // 將Soldier數值轉成Enemy用的 EnemyAttr tempAttr = new EnemyAttr(); SetCharacterAttr(tempAttr); // 設定武器 SetWeapon(theSoldier.GetWeapon()); // 更改為SoldierAI m_AI = new EnemyAI(this, AttackPos); m_AI.ChangeAIState(new IdleAIState()); }
// 攻擊加乘 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); }
// 取得Enemy的數值,傳入外部參數CritRate public override EnemyAttr GetEnemyAttr( int AttrID ) { if( m_EnemyAttrDB.ContainsKey( AttrID )==false) { Debug.LogWarning("GetEnemyAttr:AttrID["+AttrID+"]數值不存在"); return null; } // 產生數物件並設定共用的數值資料 EnemyAttr NewAttr = new EnemyAttr(); NewAttr.SetEnemyAttr( m_EnemyAttrDB[AttrID]); return NewAttr; }
public void SetCharacterAttr(EnemyAttr Attr){}
public void SetCharacterAttr(EnemyAttr Attr) { }