Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        public void PickUp(ExitGames.Client.Photon.Hashtable data)
        {
            bombStatus = BombStatus.Carried;
            int actorID = (int)data["carrierID"];
            int viewID  = (int)data["viewID"];

            bl_DemolitionBombManager.Instance.carrierActorNumber = actorID;
            //if local player is the carrier
            if (actorID == PhotonNetwork.LocalPlayer.ActorNumber)
            {
                bl_DemolitionUI.Instance.BombCarrierUI.SetActive(true);
                bombModel.SetActive(false);
            }
            else
            {
                PhotonView carrierView = bl_GameManager.Instance.FindPlayerView(viewID);
                if (carrierView == null)
                {
                    Debug.LogError("Couldn't find the carrier view"); return;
                }

                Transform carrierParent = carrierView.GetComponent <bl_PlayerSettings>().carrierPoint;
                transform.parent           = carrierParent;
                transform.localPosition    = onCarrierPosition;
                transform.localEulerAngles = onCarrierRotation;
            }
            SetColliderActive(false);
            bl_DemolitionUI.Instance.pickUpIndicationUI.SetActive(false);
            bombEffects.SetActive(false);
        }
Esempio n. 2
0
    void Start()
    {
        Instance = this;
        GameplayState.OnLightsOnEvent += delegate { widgetsActivated = true; };

        CanvasGroup       = GetComponent <CanvasGroup>();
        CanvasGroup.alpha = 0;
    }
Esempio n. 3
0
 public void On_TouchStart(Gesture gesture)
 {
     if (gesture.pickedObject == gameObject)
     {
         currentStatus = BombStatus.death;
         this.anim.SetTrigger("Explode");
         touchBomb();
     }
 }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 public void ResetToInit()
 {
     bombStatus            = BombStatus.Initial;
     transform.parent      = null;
     transform.position    = InitialPosition;
     transform.eulerAngles = InitialRotation;
     bombModel.SetActive(true);
     SetColliderActive(true);
     visibleForLocal = PhotonNetwork.LocalPlayer.GetPlayerTeam() == bl_Demolition.Instance.terroristsTeam;
 }
Esempio n. 5
0
 public void timeUp()
 {
     currentStatus = BombStatus.death;
     try
     {
         this.anim.SetTrigger("Destroy");
     }
     catch
     {
         Debug.LogWarning("se intento destruir bomba");
     }
 }
Esempio n. 6
0
        /// <summary>
        ///
        /// </summary>
        public void Drop(ExitGames.Client.Photon.Hashtable data)
        {
            bombModel.SetActive(true);
            Vector3 pos = (Vector3)data["position"];

            transform.parent   = null;
            transform.position = pos;
            transform.rotation = (Quaternion)data["rotation"];
            bombStatus         = BombStatus.Droped;
            bl_DemolitionBombManager.Instance.carrierActorNumber = -1;
            bombEffects.SetActive(false);
            SetColliderActive(true);
            bl_DemolitionUI.Instance.BombCarrierUI.SetActive(false);
        }
Esempio n. 7
0
    public void Start()
    {
        Instance = this;
        GameplayState.OnLightsOnEvent += delegate { widgetsActivated = true; };

        HUD               = gameObject.Traverse("HUD");
        TimerPrefab       = HUD.Traverse <Text>("TimerGroup", "Timer");
        TimerShadowPrefab = HUD.Traverse <Text>("TimerGroup", "TimerShadow");
        StrikesPrefab     = HUD.Traverse <Text>("StatsGroup", "Strikes");
        SolvesPrefab      = HUD.Traverse <Text>("StatsGroup", "Solves");
        NeediesPrefab     = HUD.Traverse <Text>("StatsGroup", "Needies");
        ConfidencePrefab  = HUD.Traverse <Text>("StatsGroup", "Confidence");

        Alert = transform.Find("Alert").gameObject;
        Alert.SetActive(false);

        CanvasGroup       = GetComponent <CanvasGroup>();
        CanvasGroup.alpha = 0;
    }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        public void OnEventReceived(ExitGames.Client.Photon.Hashtable data)
        {
            BombStatus getStatus = (BombStatus)(int)data["type"];

            if (getStatus == BombStatus.Carried)
            {
                PickUp(data);
            }
            else if (getStatus == BombStatus.Droped)
            {
                Drop(data);
            }
            else if (getStatus == BombStatus.Actived)
            {
                Plant(data);
            }
            else if (getStatus == BombStatus.Defused)
            {
                Defuse(data);
            }
        }
Esempio n. 9
0
        /// <summary>
        ///
        /// </summary>
        public void OnLocalPlant()
        {
            Transform  camera = bl_GameManager.Instance.LocalPlayer.GetComponent <bl_PlayerSettings>().PlayerCamera.transform;
            Vector3    dir    = camera.forward;
            Vector3    origin = camera.position;
            RaycastHit hit;
            Vector3    finalPoint = Vector3.zero;
            Quaternion rot        = Quaternion.identity;
            Ray        r          = new Ray(origin, dir);

            bombStatus = BombStatus.Actived;

            //check if there is a object in front of the player camera where stick the bomb
            if (Physics.Raycast(r, out hit, 3, layerMask, QueryTriggerInteraction.Ignore))
            {
                finalPoint = hit.point;
                rot        = Quaternion.LookRotation(hit.normal, Vector3.up);
            }
            else//otherwise just instance the bomb in front of the player position
            {
                r = new Ray(origin + dir, Vector3.down);
                if (Physics.Raycast(r, out hit, 10, layerMask, QueryTriggerInteraction.Ignore))
                {
                    finalPoint = hit.point;
                    rot        = Quaternion.LookRotation(hit.normal, Vector3.up);
                }
            }
            //send the bomb plant event to all players
            var data = bl_UtilityHelper.CreatePhotonHashTable();

            data.Add("type", (int)BombStatus.Actived);
            data.Add("position", finalPoint);
            data.Add("rotation", rot);
            data.Add("time", (float)PhotonNetwork.Time);
            data.Add("zone", bl_Demolition.Instance.plantingZone.ZoneName);
            bl_PhotonNetwork.Instance.SendDataOverNetwork(PropertiesKeys.DMBombEvent, data);

            bl_KillFeed.Instance.SendTeamHighlightMessage(PhotonNetwork.LocalPlayer.NickName, string.Format("has planted the bomb in <b>{0}</b>", bl_Demolition.Instance.plantingZone.ZoneName), PhotonNetwork.LocalPlayer.GetPlayerTeam());
            bl_GameManager.Instance.LocalPlayer.GetComponent <bl_PlayerNetwork>().gunManager.ReleaseWeapons(false);
        }
Esempio n. 10
0
        public void GenerateBombs(int colIndex, int rowIndex)
        {
            Flags     = 0;
            time      = 0;
            BombArr   = new int[Cols, Rows];
            StatusArr = new BombStatus[Cols, Rows];

            int colIndexNeigh = 0;
            int rowIndexNeigh = 0;

            while ((colIndexNeigh - colIndex + rowIndexNeigh - rowIndex) == 0)
            {
                colIndexNeigh = colIndex + RNG.Next(-1, 1);
                rowIndexNeigh = rowIndex + RNG.Next(-1, 1);
            }

            for (int i = 0; i < Cols; i++)
            {
                for (int j = 0; j < Rows; j++)
                {
                    BombArr[i, j]   = 0;
                    StatusArr[i, j] = BombStatus.notClicked;
                }
            }

            for (int i = 0; i < MaxBombs; i++)
            {
                int randCol = RNG.Next(0, Cols);
                int randRow = RNG.Next(0, Rows);

                if (BombArr[randCol, randRow] == 0 && !((randCol == colIndex || randCol == colIndex - 1 || randCol == colIndex + 1) && (randRow == rowIndex || randRow == rowIndex + 1 || randRow == rowIndex - 1)) && !((randCol == colIndexNeigh || randCol == colIndexNeigh - 1 || randCol == colIndexNeigh + 1) && (randRow == rowIndexNeigh || randRow == rowIndexNeigh + 1 || randRow == rowIndexNeigh - 1)))
                {
                    BombArr[randCol, randRow] = 1;
                }
                else
                {
                    i--;
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        ///
        /// </summary>
        void Defuse(HashTable data)
        {
            if (bombStatus == BombStatus.Defused)
            {
                return;
            }

            bombStatus = BombStatus.Defused;
            bombEffects.SetActive(false);
            bl_DemolitionBombManager.Instance.CancelDefuse(false);
            bl_Demolition.Instance.virtualAudioController.StopClip("planted loop");
            bl_Demolition.Instance.virtualAudioController.PlayClip("bomb defuse");
            if (PhotonNetwork.IsMasterClient)
            {
                bl_PhotonNetwork.Instance.SendDataOverNetwork(PropertiesKeys.DemolitionEvent, new HashTable()
                {
                    { "type", bl_Demolition.DemolitionEventType.RoundFinish },
                    { "finalType", 1 },
                    { "winner", bl_Demolition.Instance.terroristsTeam.OppsositeTeam() }
                });
            }
        }
Esempio n. 12
0
        /// <summary>
        ///
        /// </summary>
        void Plant(ExitGames.Client.Photon.Hashtable data)
        {
            bombStatus = BombStatus.Actived;
            bombModel.SetActive(true);
            Vector3    position = (Vector3)data["position"];
            Quaternion rot      = (Quaternion)data["rotation"];

            plantedTime        = (float)data["time"];
            transform.parent   = null;
            transform.position = position;
            transform.rotation = rot;
            bl_DemolitionBombManager.Instance.StartDetonationCountDown(true);
            bl_DemolitionBombManager.Instance.carrierActorNumber = -1;
            bombEffects.SetActive(true);
            bl_DemolitionUI.Instance.onPlantUI.GetComponentInChildren <Text>().text = string.Format("BOMB HAS BEEN PLANTED IN <b>{0}</b>\n<size=8>{1} SECONDS BEFORE DETONATION</size>", (string)data["zone"], bl_Demolition.Instance.DetonationTime);
            bl_DemolitionUI.Instance.onPlantUI.SetActive(true);
            bl_DemolitionUI.Instance.BombCarrierUI.SetActive(false);
            SetColliderActive(true);
            bl_Demolition.Instance.virtualAudioController.PlayClip("bomb planted");
            bl_Demolition.Instance.virtualAudioController.PlayClip("planted loop");
            bl_MatchTimeManager.Instance.PauseTime();
        }
Esempio n. 13
0
 void Awake()
 {
     initialPotition = this.gameObject.transform.position;
     anim            = this.GetComponent <Animator>();
     currentStatus   = BombStatus.stand;
 }