コード例 #1
0
 void Start()
 {
     team   = gameObject.GetComponent <TeamScript>();
     target = team.charPos[0];
     target.gameObject.AddComponent <BookBuff>();
     anim = Instantiate(Resources.Load <GameObject>("Prefabs/Skills/SkillBook") as GameObject, new Vector2(target.transform.position.x, target.transform.position.y), Quaternion.identity, target.transform);
 }
コード例 #2
0
ファイル: AIFlag.cs プロジェクト: Ryuya0914/inu
 void Awake()
 {
     // 自身のスクリプトを取得
     S_Adire = GetComponent <AIDirector>();
     m_team  = GetComponent <TeamScript>();
     RegisterEvent_ChangeHaveFlag(SetHaveFlag);
 }
コード例 #3
0
ファイル: Network.cs プロジェクト: ThemisP/GamesProject
    IEnumerator SpawnChainAndSetPlayers(Transform p1, Transform p2, TeamScript script)
    {
        yield return(new WaitForSecondsRealtime(2));

        script.SetPlayers(p1, p2);
        playerController.SetWaitingForGame(false);
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        targetTeam = GameObject.FindObjectOfType <TeamScript>();

        image      = gameObject.transform.GetChild(0).GetComponent <Image>();
        background = gameObject.GetComponent <Image>();
    }
コード例 #5
0
    void SetReceiverTeam(string receiver)
    {
        if (string.IsNullOrEmpty(receiver))
        {
            return;
        }

        if (receiver.Equals("a"))
        {
            receiverTeam = teamA;
        }
        else if (receiver.Equals("b"))
        {
            receiverTeam = teamB;
        }
        else if (receiver.Equals("c"))
        {
            receiverTeam = teamC;
        }
        else
        {
            Debug.Log("Receiver Team Null");
            receiverTeam = null;
        }

        Debug.Log("Reciever Team Set!");
    }
コード例 #6
0
 public void SetTeamForNextGame()
 {
     if (matchNumber >= 1 && matchNumber < 5)
     {
         setSemiFinalTeams(matchNumber);
     }
     else if (matchNumber >= 5 && matchNumber < 7)
     {
         if ((matchNumber - 5) % 2 == 0)
         {
             teamA = new TeamScript(semiFinal[matchNumber - 5].MatchDayResult.Winner);
             string groupName = "Final";
             teamA.Flag = SetFlagSpriteoFTeam(groupName, "TeamA", teamA.Flag.sprite);
         }
         else
         {
             teamB = new TeamScript(semiFinal[matchNumber - 5].MatchDayResult.Winner);
             string groupName = "Final";
             teamB.Flag = SetFlagSpriteoFTeam(groupName, "TeamB", teamB.Flag.sprite);
             final[(matchNumber - 5) / 2] = new MatchDay(teamA, teamB, groupName);
         }
     }
     else if (matchNumber == 7)
     {
         tournamentWinner = new TeamScript(final[0].MatchDayResult.Winner);
         string groupName = "Winner";
         tournamentWinner.Flag   = SetFlagSpriteoFTeam(groupName, "winner", tournamentWinner.Flag.sprite);
         playButton.interactable = false;
         Debug.Log("And we are done");
     }
 }
コード例 #7
0
 public TeamScript(TeamScript teamScript)
 {
     this.teamName  = teamScript.teamName;
     this.shortName = teamScript.shortName;
     this.mode      = teamScript.mode;
     this.flag      = teamScript.flag;
 }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     Debug.Log(matchNumber);
     flags = Resources.LoadAll <Sprite>("Flags");
     if (matchNumber == 0)
     {
         for (int i = 0; i < 8; i += 2)
         {
             TeamScript teamA      = null;
             TeamScript teamB      = null;
             String     groupName  = "Group" + (char)('A' + (int)(i / 2));
             Image      imageTeamA = SetFlagSpriteoFTeam(groupName, "TeamA", flags[i]);
             Image      imageTeamB = SetFlagSpriteoFTeam(groupName, "TeamB", flags[i + 1]);
             if (i == 0)
             {
                 teamA = new TeamScript(teamList[i], teamListShort[i], "human", imageTeamA);
                 teamB = new TeamScript(teamList[i + 1], teamListShort[i + 1], "bot", imageTeamB);
             }
             else
             {
                 teamA = new TeamScript(teamList[i], teamListShort[i], "bot", imageTeamA);
                 teamB = new TeamScript(teamList[i + 1], teamListShort[i + 1], "bot", imageTeamB);
             }
             MatchDay matchDay = new MatchDay(teamA, teamB, groupName);
             quarterFinal[i / 2] = matchDay;
         }
     }
 }
コード例 #9
0
 public MatchDayResult(TeamScript winner, int winScore, TeamScript loser, int loseScore)
 {
     this.winner    = winner;
     this.winScore  = winScore;
     this.loser     = loser;
     this.loseScore = loseScore;
 }
コード例 #10
0
ファイル: MatchDay.cs プロジェクト: gptarun/basketballswish
 public MatchDay(TeamScript teamA, TeamScript teamB, string currButtonName, MatchDayResult matchDayResult)
 {
     this.teamA          = teamA;
     this.teamB          = teamB;
     this.currButtonName = currButtonName;
     this.matchDayResult = matchDayResult;
 }
コード例 #11
0
 public void setVariables(int energy, float hatchtime, TeamScript teams)
 {
     heirEnergy   = energy;
     hatchTime    = hatchtime;
     timerRunning = true;
     ts           = teams;
 }
コード例 #12
0
    void Start()
    {
        targetTeam = GameObject.FindObjectOfType <TeamScript>();

        image     = gameObject.GetComponent <Image>();
        cooldown  = gameObject.transform.Find("CooldownImage").GetComponent <Image>();
        skillText = gameObject.transform.Find("SkillArrow").transform.Find("SkillText").transform.Find("Text").GetComponent <Text>();
    }
コード例 #13
0
    void Start()
    {
        type     = gameObject.GetComponent <Image>();
        cooldown = gameObject.transform.GetChild(1).GetComponent <Image>();

        targetTeam = GameObject.FindObjectOfType <TeamScript>();
        //targetSkill = targetTeam.charPos[0].GetComponent<Skill>();
    }
コード例 #14
0
ファイル: Network.cs プロジェクト: ThemisP/GamesProject
    public void SpawnPlayer(int id, string username, int team, Vector3 pos, Vector3 rot, float health)
    {
        if (id == ClientIndex)
        {
            return;
        }
        if (playersInGame.ContainsKey(id))
        {
            return;
        }
        GameObject playerObj;

        if (team == player.GetTeamNumber())
        {
            playerObj = GameObject.Instantiate(TeammatePlayerPrefab, pos, Quaternion.Euler(rot));
            Team      = GameObject.Instantiate(SimplifiedTeamPrefab, new Vector3(0, 1, 0), Quaternion.Euler(new Vector3(0, 0, 0)));

            TeamScript script = Team.GetComponent <TeamScript>();
            if (script != null)
            {
                StartCoroutine(SpawnChainAndSetPlayers(player.GetPlayerObj().transform, playerObj.transform, script));
            }
            else
            {
                Debug.Log("teamScript error");
            }

            PlayerController teammateController = player.GetPlayerObj().GetComponent <PlayerController>();
            if (teammateController != null)
            {
                teammateController.SetTeamController(script);
            }
            else
            {
                Debug.Log("Cannot find controller");
            }
            teamMateIndex = id;
        }
        else
        {
            playerObj = GameObject.Instantiate(EnemyPlayerPrefab, pos, Quaternion.Euler(rot));
        }
        EnemyPlayerController controller = playerObj.GetComponent <EnemyPlayerController>();

        if (controller == null)
        {
            Debug.LogError("Controller not found in spawned player");
        }
        else
        {
            Debug.Log("register " + id);
            controller.SetPlayerId(id);
            controller.SetUsername(username);
            controller.SetTeamNumber(team);
            controller.SetHealth(health);
            playersInGame.Add(id, controller);
        }
    }
コード例 #15
0
    public void skill()
    {
        targetTeam = gameObject.transform.GetComponentInParent <TeamScript>();

        targetTeam.gameObject.AddComponent <TeamBookBuff>();

        elapsedTime = cooldown;
        skillCooldown();
    }
コード例 #16
0
ファイル: AIGun.cs プロジェクト: Ryuya0914/inu
    void SetTeam()
    {
        TeamScript team = GetComponent <TeamScript>();

        for (int i = 0; i < bullets.Count; ++i)
        {
            bullets[i].GetComponent <Bullet>().m_myTeam = team;
        }
    }
コード例 #17
0
 public void ExecuteAction(ActionTemplate template, TeamScript team)
 {
     if (!Character.IsDead &&
         !template.Targeting.GetTarget(this, team).Character.IsDead&&
         _actionBeingExecuted == null)
     {
         template.ExecuteAction(this, team);
     }
 }
コード例 #18
0
ファイル: SelectTeam.cs プロジェクト: gptarun/basketballswish
    public void SetTeamForTournament()
    {
        //tournament.SetTeam(teamList[indexA].ToString(), teamList[indexB].ToString(),modeA,modeB,teamAFlag.image.sprite,teamBFlag.image.sprite, currButtonName);
        Image      imageTeamA = SetFlagSpriteoFTeam(currButtonName, "TeamA", teamAFlag.image.sprite);
        Image      imageTeamB = SetFlagSpriteoFTeam(currButtonName, "TeamB", teamBFlag.image.sprite);
        TeamScript teamA      = new TeamScript(teamList[indexA].ToString(), teamListShort[indexA].ToString(), modeA, imageTeamA);
        TeamScript teamB      = new TeamScript(teamList[indexB].ToString(), teamListShort[indexB].ToString(), modeB, imageTeamB);

        tournament.SetTeam(new MatchDay(teamA, teamB, currButtonName));
    }
コード例 #19
0
    public void findEnnemy(int x, int y, TeamScript team, List <Transform> toReturn)
    {
        Transform character = matrix[x, y].Find("Character");

        //Debug.Log(character.gameObject.GetComponent<CharacterScript>().team.teamNumber);
        if (character != null && character.gameObject.GetComponent <CharacterScript>().team.teamNumber != team.teamNumber)
        {
            toReturn.Add(character);
        }
    }
コード例 #20
0
    public void HexPosWithEnnemies(int x, int y, TeamScript team)
    {
        List <Transform> toReturn = new List <Transform>();

        //X+1 Y
        if (x + 1 >= 0 && x + 1 < gridWidth && y >= 0 && y < gridHeight)
        {
            findEnnemy(x + 1, y, team, toReturn);
        }
        //X Y+1
        if (x >= 0 && x < gridWidth && y + 1 >= 0 && y + 1 < gridHeight)
        {
            findEnnemy(x, y + 1, team, toReturn);
        }
        //X-1 Y
        if (x - 1 >= 0 && x - 1 < gridWidth - 1 && y >= 0 && y < gridHeight)
        {
            findEnnemy(x - 1, y, team, toReturn);
        }
        //X Y-1
        if (x >= 0 && x < gridWidth && y - 1 >= 0 && y - 1 < gridHeight)
        {
            findEnnemy(x, y - 1, team, toReturn);
        }
        //Cases diagonales
        if (y % 2 == 0)
        {
            //X-1 Y-1
            if (x - 1 >= 0 && x - 1 < gridWidth && y - 1 >= 0 && y - 1 < gridHeight)
            {
                findEnnemy(x - 1, y - 1, team, toReturn);
            }
            //X-1 Y+1
            if (x - 1 >= 0 && x - 1 < gridWidth && y + 1 >= 0 && y + 1 < gridHeight)
            {
                findEnnemy(x - 1, y + 1, team, toReturn);
            }
        }
        else
        {
            //X+1 Y-1
            if (x + 1 >= 0 && x + 1 < gridWidth && y - 1 >= 0 && y - 1 < gridHeight)
            {
                findEnnemy(x + 1, y - 1, team, toReturn);
            }
            //X+1 Y+1
            if (x + 1 >= 0 && x + 1 < gridWidth && y + 1 >= 0 && y + 1 < gridHeight)
            {
                findEnnemy(x + 1, y + 1, team, toReturn);
            }
        }
        listEnnemy = toReturn;
    }
コード例 #21
0
ファイル: PlayerFlag.cs プロジェクト: Ryuya0914/inu
 public void SetTeam()
 {
     m_team = GetComponent <TeamScript>();
     if (m_team.m_teamColor == TeamScript.TeamColor.REDTEAM)
     {
         m_teamNum = 0;
     }
     else
     {
         m_teamNum = 1;
     }
 }
コード例 #22
0
    private Vector3 calculateBestPosition(TeamScript tS)
    {
        int     number = 0;
        Vector3 sum    = new Vector3(0, 0, 0);

        foreach (Transform c in tS.characters)
        {
            sum += c.parent.localPosition;
            number++;
        }
        return(sum / number);
    }
コード例 #23
0
    private IEnumerator checkGameOver(TeamScript tS, String winner)
    {
        Debug.Log("in checkOver");
        if (tS.characters.Count == 0)
        {
            //Show tS.teamNumber winner
            TextUpdater.GetInstance().UpdateGameOver("End Of Party\n" + winner + "\nwin the party !");
            //End Game and Return To Menu
            yield return(new WaitForSeconds(2));

            OnGameOver.Invoke();
        }
    }
コード例 #24
0
ファイル: Network.cs プロジェクト: ThemisP/GamesProject
    public void JoinGameOffline()
    {
        HUD.SetActive(true);
        Transform spawnpoint;

        if (SpawnPoints.Count > 0 && SpawnPoints.TryGetValue((0 + 1) % SpawnPoints.Count, out spawnpoint))
        {
            GameObject playerObj = GameObject.Instantiate(PlayerPrefab, spawnpoint.position, spawnpoint.rotation);
            player.SetPlayerObj(playerObj);
            PlayerController playerContr = playerObj.GetComponent <PlayerController>();
            if (playerContr == null)
            {
                Debug.LogError("PlayerController not found when joining game");
            }
            else
            {
                playerController = playerContr;
            }

            GameObject teammateObj = GameObject.Instantiate(TeammatePlayerPrefab, spawnpoint.position + Vector3.forward * 2, spawnpoint.rotation);
            Team = GameObject.Instantiate(SimplifiedTeamPrefab, new Vector3(0, 1, 0), Quaternion.Euler(new Vector3(0, 0, 0)));

            TeamScript script = Team.GetComponent <TeamScript>();
            if (script != null)
            {
                StartCoroutine(SpawnChainAndSetPlayers(playerObj.transform, teammateObj.transform, script));
            }
            else
            {
                Debug.Log("teamScript error");
            }

            PlayerController controller = playerObj.GetComponent <PlayerController>();
            if (controller != null)
            {
                controller.SetTeamController(script);
            }
            else
            {
                Debug.Log("cannot find controller");
            }

            player.SetOffline(true);
            cameraScript.SetTarget(playerObj.transform);
            ShrinkCircle.instance.StartCircle();
        }
        else
        {
            Debug.LogError("Spawnpoint transform not found");
        }
    }
コード例 #25
0
ファイル: Naviagtor.cs プロジェクト: LongHairedCoder/FFF
    public void setVariables(TeamScript ts, int heirEnergy)
    {
        teamscript = ts;
        #region movement
        speed = ts.speed;
        movingEnergyConsumption = ts.movingEnergyConsumption;
        actionAfterFeast        = ts.actionAfterFeast;
        #endregion

        #region foodManagement

        energy = heirEnergy;
        Array.Copy(ts.eatingEfficiency, eatingEfficiency, ts.eatingEfficiency.Length);
        idleEnergyConsumption = ts.idleEnergyConsumption;
        energyForEgg          = ts.energyForEgg;
        #endregion


        #region scouting
        scoutingType        = ts.scoutingType;
        scoutingSpeed       = ts.scoutingSpeed;
        scoutingConsumption = ts.scoutingConsumption;
        #endregion

        #region scan
        scanType            = ts.scanType;
        scanSpeed           = ts.scanSpeed;
        vision.scanType     = scanType;
        vision.scanSpeed    = scanSpeed;
        vision.visionAngle  = ts.visionAngle;
        vision.visionRadius = ts.visionRadius;
        #endregion


        #region jump
        jumpEnergyConsumption = ts.jumpEnergyConsumption;
        forwardJumpForce      = ts.forwardJumpForce;
        upJumpForce           = ts.upJumpForce;
        backJump        = ts.backJump;
        backJumpForce   = ts.backJumpForce;
        upBackJumpForce = ts.upBackJumpForce;
        #endregion


        #region Focus

        maxFocus = ts.maxFocus;

        #endregion
    }
コード例 #26
0
ファイル: AIDirector.cs プロジェクト: Ryuya0914/inu
    void Awake()
    {
        S_Amove   = GetComponent <AIMove>();
        S_Aflag   = GetComponent <AIFlag>();
        S_Agun    = GetComponent <AIGun>();
        S_Asearch = GetComponent <AIRouteSearch>();
        S_Alife   = GetComponent <AILife>();
        S_Atrans  = GetComponent <AITransChange>();
        S_Team    = GetComponent <TeamScript>();

        RegisterEvent_ChangeState(SetNowState);
        RegisterEvent_ChangeFindEnemyFlag(SetFindEnemyFlag);
        S_Aflag.RegisterEvent_ChangeHaveFlag(ChangeFlagState);
    }
コード例 #27
0
    public void skill()
    {
        targetTeam = gameObject.transform.GetComponentInParent <TeamScript>();

        for (int i = 0; i < targetTeam.charPos.Length; i++)
        {
            DecreaseDamageBuff buff = targetTeam.charPos[i].gameObject.AddComponent <DecreaseDamageBuff>();
            buff.duration  = 6.0f;
            buff.intensity = 0.2f;
        }

        elapsedTime = cooldown;
        skillCooldown();
    }
コード例 #28
0
    public void ExecuteAction(CombatCharacterScript user, TeamScript team)
    {
        if (Time.time >= CooldownFinish)
        {
            ActionInstance action = GenerateInstance();
            action.User     = user;
            action.Target   = _targeting.GetTarget(user, team);
            action.Template = this;

            OnStart.Trigger(action);
            user.Character.OnActionStart.Trigger(action);
            action.Target.Character.OnEnemyActionStart.Trigger(action);
        }
    }
コード例 #29
0
    public void skill()
    {
        targetTeam = gameObject.transform.GetComponentInParent <TeamScript>();

        for (int i = 0; i < targetTeam.charPos.Length; i++)
        {
            if (targetTeam.charPos[i].alive)
            {
                targetTeam.charPos[i].applyHeal(Mathf.RoundToInt(targetTeam.charPos[i].maxHP * 0.1f));
            }
        }

        elapsedTime = cooldown;
        skillCooldown();
    }
コード例 #30
0
 public void setSemiFinalTeams(int i)
 {
     i = (i - 1);
     if (i % 2 == 0)
     {
         teamA = new TeamScript(quarterFinal[i].MatchDayResult.Winner);
         string groupName = "Semi" + (char)('A' + (int)(i / 2));
         teamA.Flag = SetFlagSpriteoFTeam(groupName, "TeamA", teamA.Flag.sprite);
     }
     else
     {
         teamB = new TeamScript(quarterFinal[i].MatchDayResult.Winner);
         string groupName = "Semi" + (char)('A' + (int)(i / 2));
         teamB.Flag       = SetFlagSpriteoFTeam(groupName, "TeamB", teamB.Flag.sprite);
         semiFinal[i / 2] = new MatchDay(teamA, teamB, groupName);
     }
 }