Exemple #1
0
    public void UpdateTargetsOfWaitingPlayers()
    {
        foreach (var item in players)
        {
            PlayerBase pb = item.GetComponent <PlayerBase>();
            if (pb.Role() != "GoalKeeper")
            {
                FieldPlayer fp = item.GetComponent <FieldPlayer>();
                if (fp.GetFSM() == null)
                {
                    Debug.Log("No FSM");
                }
                if (fp.GetFSM().IsInstate(Wait.instance) || fp.GetFSM().IsInstate(ReturnToHomeRegion.instance))
                {
                    //Debug.Log("원래는 fp.steering().settarget(~~)\n https://github.com/wangchen/Programming-Game-AI-by-Example-src/blob/master/Buckland_Chapter4-SimpleSoccer/SoccerTeam.cpp");

                    if (fp.Team().teamColor == TeamColor.Blue)
                    {
                        fp.Steering().SetTarget((fp.Team().initialRegion[fp.ID() - 6]));
                    }
                    else
                    {
                        fp.Steering().SetTarget((fp.Team().initialRegion[fp.ID() - 1]));
                    }
                    //    fp.gameObject.GetComponent<PlayerBase>().Steering().SetTarget(fp.HomeRegion());
                }
            }
        }
    }
 public void RemoveEntity(FieldPlayer pEntity)
 {
     m_EntityMap.Remove(pEntity.ID());
 }
Exemple #3
0
    public void RequestPass(FieldPlayer requester)
    {
        float randFloat = Random.Range(0f, 1f);

        if (randFloat > .5f)
        {
            return;
        }
        if (IsPassSafeFromAllOpponents(ControllingPlayer().transform.position, requester.transform.position, requester.gameObject, Prm.instance.MaxPassingForce))
        {
            MessageDispatcher_CH4.instance.DispatchMessage(0f, ControllingPlayer().GetComponent <FieldPlayer>().ID(), requester.ID(), SoccerMessages.Msg_PassToMe, requester.transform);
        }
    }