Exemplo n.º 1
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
        levelManager = GetComponent <LevelManager> ();
        boardManager = GetComponent <BoardManager> ();
        clickManager = GetComponent <ClickManager> ();

        gopherManager        = GetComponent <GopherManager> ();
        catManager           = GetComponent <CatManager> ();
        dogManager           = GetComponent <DogManager> ();
        dogCatcherManager    = GetComponent <DogCatcherManager> ();
        policeManager        = GetComponent <PoliceManager> ();
        bloodHoundManager    = GetComponent <BloodhoundManager> ();
        militaryManager      = GetComponent <MilitaryManager> ();
        enemyMilitaryManager = GetComponent <EnemyMilitaryManager> ();
        audioManager         = GetComponent <AudioSource> ();

        managers.Add(gopherManager);
        managers.Add(catManager);
        managers.Add(dogManager);
        managers.Add(dogCatcherManager);
        managers.Add(policeManager);
        managers.Add(bloodHoundManager);
        managers.Add(militaryManager);
        managers.Add(enemyMilitaryManager);
        Screen.SetResolution(800, 800, false);
    }
Exemplo n.º 2
0
    public void SetUp( )
    {
        inmigrantManager = FindObjectOfType <InmigrantManager>();
        policeManager    = FindObjectOfType <PoliceManager>();
        crFacility       = FindObjectOfType <CentroDeRetencion>();

        if (!inmigrantManager || !policeManager || !crFacility)
        {
            throw new System.Exception("Asegurate de que los managers estan en escena");
        }

        TimerController.dailyEvent.AddListener(DailyActions);
        TimerController.monthlyEvent.AddListener(MonthlyActions);
    }
        /// <summary>
        /// Обработчик оплаты штрафа для снятия розыска
        /// </summary>
        private void PayPenalty(Client player, object[] objects)
        {
            var playerInfo = PlayerInfoManager.GetInfo(player);

            if (playerInfo.Wanted.WantedLevel == 0)
            {
                API.sendNotificationToPlayer(player, "~r~Вы не в розыске", true);
                return;
            }
            var penalty = PoliceManager.CalculatePenalty(playerInfo);

            if (playerInfo.Balance < penalty)
            {
                API.sendNotificationToPlayer(player, "~b~Недостаточно средств", true);
                return;
            }
            playerInfo.Balance -= penalty;
            PlayerInfoManager.RefreshUI(player, playerInfo);
            PlayerInfoManager.ClearWanted(player);
            API.sendNotificationToPlayer(player, "~b~Вы сняты с розыска");
        }
Exemplo n.º 4
0
    public static BehaviourTreeInstance Exemplify(PoliceManager pm)
    {
        Policeman p = new Policeman("Bobby");

        var patrollingPoliceBehaviourTreeTwoResults =

            new SelectorNode(
                pm.IfChaseGotKid,
                new ActionNode(pm.ActionBringChildToStation),
                new SequencerNode(new BehaviourTreeNode[] {
            new ActionNode(pm.ActionWander), new ActionNode(pm.ActionSmoke)
        })
                );

        var patrollingPoliceBehaviourTreeTwoResultsSimple =

            new SelectorNode(
                pm.IfChaseGotKid,
                new ActionNode(pm.ActionBringChildToStation),
                new ActionNode(pm.ActionSmoke)
                );

        var patrollingPoliceBehaviourArrayResults =

            new SelectorArrayNode(
                pm.IfChaseGotKidCases,
                new BehaviourTreeNode[] {
            new ActionNode(pm.ActionBringChildToStation),
            new ActionNode(pm.ActionWander),
            new ActionNode(pm.ActionSmoke)
        }
                );

        BehaviourTreeInstance instance =
            new BehaviourTreeInstance(patrollingPoliceBehaviourArrayResults, p, 1);

        return(instance);
    }
Exemplo n.º 5
0
    void Start()
    {
        //GET
        inputControl       = GetComponent <InputController>();
        uiController       = GetComponent <UIController>();
        cameraController   = Camera.main.GetComponent <CameraBehaviour>();
        timerController    = GetComponentInChildren <TimerController>();
        resourceController = GetComponentInChildren <ResourceController>();
        //GET Managers
        buildingsManager = FindObjectOfType <CentroDeRetencion>();
        inmigrantManager = FindObjectOfType <InmigrantManager>();
        policeManager    = FindObjectOfType <PoliceManager>();

        //SET Controllers
        inputControl.SetUp(ref globalState);
        uiController.SetUP();
        timerController.SetUP();
        resourceController.SetUp();
        //Set Managers
        buildingsManager.SetUP();
        inmigrantManager.SetUp();
        policeManager.SetUp();
    }
Exemplo n.º 6
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 7
0
 void Awake()
 {
     _instance = this;
 }
Exemplo n.º 8
0
    void cardToPlayer(CardInfo card, PlayerManager thisPlayer)
    {
        TrainConnection thisPlayerStandTrainConnection = thisPlayer.PlayerMoveController.PlayerTrainConnection;

        thisAccountPlayerStandTrainManager = thisPlayerStandTrainConnection.trainManager;

        if (thisPlayer.IsDie)
        {
            reactionManager.SetPlayerDie();
            return;
        }
        thisAccountPlayerManager.SetPlay(true);

        switch (card.cardType)
        {
        case CardType.Up:

            if (thisPlayerStandTrainConnection.nearbyTrain_Up != null)
            {
                thisPlayer.PlayerMoveController.Move(thisPlayerStandTrainConnection.nearbyTrain_Up);
                reactionManager.SetActionSuccess();
            }
            else
            {
                reactionManager.SetActionFail(CardType.Up);
            }

            break;

        case CardType.Down:

            if (thisPlayerStandTrainConnection.nearbyTrain_Down != null)
            {
                thisPlayer.PlayerMoveController.Move(thisPlayerStandTrainConnection.nearbyTrain_Down);
                reactionManager.SetActionSuccess();
            }
            else
            {
                reactionManager.SetActionFail(CardType.Down);
            }

            break;

        case CardType.Left:

            if (thisPlayerStandTrainConnection.nearbyTrain_Left != null)
            {
                thisPlayer.PlayerMoveController.Move(thisPlayerStandTrainConnection.nearbyTrain_Left);
                reactionManager.SetActionSuccess();
            }
            else
            {
                reactionManager.SetActionFail(CardType.Left);
            }

            break;

        case CardType.Right:

            if (thisPlayerStandTrainConnection.nearbyTrain_Right != null)
            {
                thisPlayer.PlayerMoveController.Move(thisPlayerStandTrainConnection.nearbyTrain_Right);
                reactionManager.SetActionSuccess();
            }
            else
            {
                reactionManager.SetActionFail(CardType.Right);
            }

            break;

        case CardType.Pick:

            thisAccountItemHolderList = thisAccountPlayerStandTrainManager.GetAllItemHolder;
            if (thisAccountItemHolderList.Count > 0)
            {
                SetMarkableMark(thisAccountItemHolderList.ToArray(), true);
            }
            else
            {
                reactionManager.SetActionFail(CardType.Pick);
            }

            break;

        case CardType.Punch:

            thisAccountCanAttackPlayerManagerList = thisAccountPlayerStandTrainManager.GetAllPlayerManager;
            if (thisAccountCanAttackPlayerManagerList.Count > 1)
            {
                SetMarkableMark(thisAccountCanAttackPlayerManagerList.ToArray(), thisPlayer, true);
            }
            else
            {
                reactionManager.SetActionFail(CardType.Punch);
            }

            break;

        case CardType.Shot:

            if (thisAccountPlayerManager.PlayerBulletController.BulletCount <= 0)
            {
                reactionManager.SetNoBullet();
                return;
            }

            if (thisAccountPlayerStandTrainManager.IsRoof)
            {
                List <TrainManager> roofTrainManagerList = GameManager.Instance.gamePlayManager.trainCommander.RoofTrainManagerList;

                for (int i = 0; i < roofTrainManagerList.Count; i++)
                {
                    List <PlayerManager> thisRoofPlayerManagerList = roofTrainManagerList [i].GetAllPlayerManager;
                    thisAccountCanAttackPlayerManagerList.AddRange(thisRoofPlayerManagerList);
                }
            }
            else
            {
                if (thisPlayerStandTrainConnection.nearbyTrain_Left != null)
                {
                    TrainManager leftTrainManager = thisPlayerStandTrainConnection.nearbyTrain_Left.trainManager;
                    if (leftTrainManager != null && leftTrainManager.GetAllPlayerManager.Count != 0)
                    {
                        thisAccountCanAttackPlayerManagerList.AddRange(leftTrainManager.GetAllPlayerManager);
                    }
                }
                if (thisPlayerStandTrainConnection.nearbyTrain_Right != null)
                {
                    TrainManager rightTrainManager = thisPlayerStandTrainConnection.nearbyTrain_Right.trainManager;
                    if (rightTrainManager != null && rightTrainManager.GetAllPlayerManager.Count != 0)
                    {
                        thisAccountCanAttackPlayerManagerList.AddRange(rightTrainManager.GetAllPlayerManager);
                    }
                }
            }
            if (thisAccountCanAttackPlayerManagerList.Count > 0)
            {
                SetMarkableMark(thisAccountCanAttackPlayerManagerList.ToArray(), thisPlayer, true);
            }
            else
            {
                reactionManager.SetActionFail(CardType.Shot);
            }

            break;

        case CardType.Police:

            if (policeManager == null)
            {
                policeManager = FindObjectOfType <PoliceManager> ();
            }

            GameManager.Instance.gamePlayManager.cameraController.ForcusOnPos(policeManager.PolicePosition);
            policeManager.ShowPath();

            break;
        }
    }
Exemplo n.º 9
0
 protected override void Awake()
 {
     base.Awake();
     pm = (PoliceManager)manager.GetComponent(getManager());
     angleGoStraight = pm.angleGoStraight;
 }
Exemplo n.º 10
0
 public void LeavePolice()
 {
     policeManager = null;
 }
Exemplo n.º 11
0
 public void StorePolice(PoliceManager targetPoliceManager)
 {
     policeManager = targetPoliceManager;
     targetPoliceManager.standPos  = transform.position + Vector3.right * 0.5f * ((float)allPlayerManagerList.Count / 2);
     targetPoliceManager.standPos += Vector3.left * 0.5f * allPlayerManagerList.Count;
 }