コード例 #1
0
    public void CreateUnitType(int count, UnitTeams team, string type)
    {
        GameObject   prefab = null;
        GameObject   go;
        BaseUnit     unitScript;
        UnitSettings settings;

        UnitPrefabs unitPrefabs = prefabs.Find(t => t.team == team);

        if (unitPrefabs.prefabs != null)
        {
            prefab = unitPrefabs.prefabs.Find(t => t.name.ToLower().Contains(type.ToLower()));
        }

        if (prefab != null)
        {
            for (int i = 0; i < count; i++)
            {
                go = Instantiate(prefab, GetRandomUnitPosition(unitPrefabs), Quaternion.identity);
                go.transform.rotation = Quaternion.LookRotation(new Vector3(-go.transform.position.x, 0, 0));
                unitScript            = go.GetComponent <BaseUnit>();
                settings = unitSettings.Find(t => t.team.ToLower() == team.ToString().ToLower() && t.unitType.ToLower() == type.ToLower());
                unitScript.Init(settings);
            }
        }
    }
コード例 #2
0
    public UnitMeta(String name, UnitTeams team, Int32 idx)
    {
        Name = name;
        Team = team;
        switch (team)
        {
        case UnitTeams.Blue:
            SpriteIdx = _blue[idx];
            break;

        case UnitTeams.Brown:
            SpriteIdx = _brown[idx];
            break;

        case UnitTeams.Green:
            SpriteIdx = _green[idx];
            break;

        case UnitTeams.Pink:
            SpriteIdx = _pink[idx];
            break;

        case UnitTeams.Purple:
            SpriteIdx = _purple[idx];
            break;

        case UnitTeams.Teal:
            SpriteIdx = _teal[idx];
            break;
        }
    }
コード例 #3
0
 public virtual void Init(UnitSettings settings)
 {
     this.lifes          = settings.lifes;
     this.moveSpeed      = settings.moveSpeed;
     this.rotationSpeed  = settings.rotationSpeed;
     this.attackDistance = settings.attackDistance;
     this.attackDamage   = settings.attackDamage;
     this.attackDelay    = settings.attackDelay;
     this.myTeam         = settings.team == "People" ? UnitTeams.people : UnitTeams.zombie;
     AddToList();
 }
コード例 #4
0
 public void SetTeamCount(UnitTeams team, int count)
 {
     if (team == UnitTeams.people)
     {
         if (teamPCount != null)
         {
             teamPCount.text = count.ToString();
         }
     }
     else if (teamZCount != null)
     {
         teamZCount.text = count.ToString();
     }
 }
コード例 #5
0
ファイル: HexCell.cs プロジェクト: LordAbver/hexagon
 public Boolean HasEnemyUnit(UnitTeams team)
 {
     return(Unit && Unit.Team != team);
 }