示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="roleType">角色类型</param>
 /// <param name="rolePath">角色模型路径</param>
 /// <param name="arrowPath">发射箭矢的模型路径</param>
 /// <param name="spawnPosition">出生位置</param>
 public RoleData(RoleType roleType, string rolePath, string arrowPath, string explosionPath, Transform spawnPosition)
 {
     this.RoleType         = roleType;
     this.RolePrefab       = Resources.Load <GameObject>(rolePath);
     this.ArrowPrefab      = Resources.Load <GameObject>(arrowPath);
     this.SpawnPosition    = spawnPosition.position;
     this.ExplostionEffect = Resources.Load(explosionPath) as GameObject;
     ArrowPrefab.GetComponent <ArrowMove>().explosionEffect = ExplostionEffect;
 }
示例#2
0
 public RoleData(RoleType roleType, string rolePath, string arrowPath, string effectPath, Transform spawnPos)
 {
     this.RoleType    = roleType;
     this.RolePrefab  = Resources.Load(rolePath) as GameObject;
     this.ArrowPrefab = Resources.Load(arrowPath) as GameObject;
     this.Effect      = Resources.Load(effectPath) as GameObject;
     ArrowPrefab.GetComponent <Arrow>().effect = this.Effect;
     this.SpawnPosition = spawnPos.position;
 }
//構造函式
//用來構造角色,參數是roleType、角色prefabs路徑、箭prefabs路徑、粒子prefabs路徑、生成位置
//也用來放在字典內提供查找,RoleType是key,RoleData是value
    public RoleData(RoleType roleType,string rolePath,string arrowPath,string explosionPath, Transform spawnPos)
    {
        this.RoleType = roleType;
        this.RolePrefab = Resources.Load(PREFIX_PREFAB+ rolePath) as GameObject;
        this.ArrowPrefab = Resources.Load(PREFIX_PREFAB + arrowPath) as GameObject;
        this.ExplostionEffect = Resources.Load(PREFIX_PREFAB + explosionPath) as GameObject;
        ArrowPrefab.GetComponent<Arrow>().explosionEffect = ExplostionEffect;
        this.SpawnPosition = spawnPos.position;
    }
示例#4
0
 public RoleData(RoleType roleType, string rolePath, string arrowPath, string explosionPath, Transform spawnPos)
 {
     RoleType        = roleType;
     RolePrefab      = Resources.Load(PREFABPATH + rolePath) as GameObject;
     ArrowPrefab     = Resources.Load(PREFABPATH + arrowPath) as GameObject;
     ExplosionEffect = Resources.Load(PREFABPATH + explosionPath) as GameObject;
     ArrowPrefab.GetComponent <Arrow>().explosionEffect = ExplosionEffect;
     SpawnPosition = spawnPos.position;
 }
示例#5
0
 public RoleData(RoleType roleType, string rolePfbPath, string arrowPfbPath, string explosionEftPath, Transform birthplace)
 {
     RoleType        = roleType;
     RolePrefab      = Resources.Load(prefix_prefab + rolePfbPath) as GameObject;
     ExplosionEffect = Resources.Load(prefix_prefab + explosionEftPath) as GameObject;
     ArrowPrefab     = Resources.Load(prefix_prefab + arrowPfbPath) as GameObject;
     ArrowPrefab.GetComponent <Arrow>().explosionEffect = ExplosionEffect;
     Birthplace = birthplace.position;
 }
示例#6
0
 public RoleData(RoleType roleType, string rolePath, string arrowPath, string effectPath, int mapIndex)
 {
     RoleType         = roleType;
     RolePrefab       = Resources.Load(ROLE_PATH + rolePath) as GameObject;
     ArrowPrefab      = Resources.Load(ROLE_PATH + arrowPath) as GameObject;
     ExplostionEffect = Resources.Load(ROLE_PATH + effectPath) as GameObject;
     ArrowPrefab.GetComponent <Arrow>().explostionEffect = ExplostionEffect;
     mapInfo       = new MapInfo(mapIndex, roleType);
     SpawnPosition = mapInfo.CurrentRolePos.position;
 }
示例#7
0
    public RoleData(RoleType roleType, string rolePath, string arrowPath, string effectPath, Transform spawnPos)
    {
        this.RoleType    = roleType;
        this.RolePrefab  = Resources.Load(rolePath) as GameObject;
        this.ArrowPrefab = Resources.Load(arrowPath) as GameObject;
        this.BrustEffect = Resources.Load(effectPath) as GameObject;

        arrowPool       = ObjectPool.CreateObjectPool(ArrowPrefab, ArrowPrefab.name + "Pool", 20, true, true, true);
        brustEffectPool = ObjectPool.CreateObjectPool(BrustEffect, BrustEffect.name + "Pool", 20, true, true, true);
        ArrowPrefab.GetComponent <Arrow>().brustEffect = BrustEffect;
        ArrowPrefab.GetComponent <Arrow>().effectPool  = brustEffectPool;
        ArrowPrefab.GetComponent <Arrow>().type        = RoleType;
        this.SpawnPosition = spawnPos.position;
    }