Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.TryGetComponent <Coin>(out Coin coin))
     {
         Destroy(coin.gameObject);
         CoinCollected?.Invoke(coin);
     }
 }
Ejemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Player"))
     {
         CoinCollected?.Invoke();
         collectionSound.Play();
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Coin"))
     {
         _coins++;
         CoinCollected?.Invoke(_coins);
         Destroy(collision.gameObject);
     }
 }
Ejemplo n.º 4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Coin coin = collision.GetComponent <Coin>();

        if (coin)
        {
            _wallet += coin.TakeCoin();
            CoinCollected?.Invoke(_wallet);
        }
    }
Ejemplo n.º 5
0
    private void Start()
    {
        CoinCollected?.Invoke(_coins);

        Ray ray = new Ray(transform.position, Vector3.forward);

        Physics.Raycast(ray, out RaycastHit hitInfo);
        _stick           = Instantiate(_stickTemplate, GetSpawnPsition(hitInfo.point), _stickTemplate.transform.rotation);
        transform.parent = _stick.FixationPoint;
        _rigidbody       = GetComponent <Rigidbody>();
    }
Ejemplo n.º 6
0
    public static void SaveCoin(CoinData coinData)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Path.Combine(Application.persistentDataPath, "coin.Thuong");

        FileStream stream = new FileStream(path, FileMode.Create);

        CoinCollected coinCollected = new CoinCollected(coinData);

        formatter.Serialize(stream, coinCollected);
        stream.Close();
    }
Ejemplo n.º 7
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     //Если у объектов есть только тэг и имя, без скрипта внутри, как еще их можно определять?
     if (collision.gameObject.tag == "ground")
     {
         _isGrounded = true;
     }
     else if (collision.gameObject.GetComponent <SawInfiniteRotation>() != null)
     {
         ApplyDamage();
     }
     else if (collision.gameObject.gameObject.tag == "coin")
     {
         Destroy(collision.gameObject);
         if (CoinCollected != null)
         {
             CoinCollected.Invoke();
         }
     }
 }
Ejemplo n.º 8
0
    public static CoinCollected LoadCoin()
    {
        string path = Path.Combine(Application.persistentDataPath, "coin.Thuong");

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            CoinCollected data = formatter.Deserialize(stream) as CoinCollected;

            stream.Close();

            return(data);
        }
        else
        {
            Debug.LogError("Save file not found in " + path);
            return(null);
        }
    }
Ejemplo n.º 9
0
 public void CoinPickedUp(GameObject coin)
 {
     coin.SetActive(false);
     activeCoins--;
     CoinCollected.Invoke();
 }
Ejemplo n.º 10
0
 public void CollectCoin()
 {
     _coins++;
     CoinCollected?.Invoke(_coins);
 }
        // Token: 0x06001405 RID: 5125 RVA: 0x00020834 File Offset: 0x0001F834
        protected override WorkflowElement CreateBody()
        {
            StateGraph            stateGraph = new StateGraph(string.Format("OpponentTreasureHunt: {0}", base.Entrant.Opponent.OpponentName));
            State                 state      = new State("initial");
            State                 state2     = new State("hunting");
            State                 state3     = new State("collected");
            State                 state4     = new State("huntover");
            State                 item       = new State("done");
            PrepareScoringMethod  item2      = new PrepareScoringMethod(base.Event, base.Entrant);
            SendNews              item3      = new SendNews(base.Event, base.Entrant);
            EnableHud             item4      = new EnableHud(base.Event, EnableHud.HudToggle.Enable);
            OnUpdateTick          activity   = new OnUpdateTick(base.Event, base.Entrant);
            DisableTriggerOnEnter activity2  = new DisableTriggerOnEnter(base.Event, base.Entrant, Ports.Gameplay);
            DisplayFlasher        item5      = new DisplayFlasher(base.Event, base.Entrant, this.allCoinsCollectedFlasher);
            RemoveFlasher         item6      = new RemoveFlasher(base.Event, base.Entrant, this.allCoinsCollectedFlasher);
            EnableHud             item7      = new EnableHud(base.Event, EnableHud.HudToggle.Dispose);
            CleanupScoringMethod  item8      = new CleanupScoringMethod(base.Event, base.Entrant);
            EntrantFinished       activity3  = new EntrantFinished(base.Event, base.Entrant, 8202);
            PostEventScreen       activity4  = new PostEventScreen(base.Event, base.Entrant, Ports.Gameplay);
            RefreshPersona        item9      = new RefreshPersona(base.Event, base.Entrant);
            VisualEffect          item10     = new VisualEffect(EffectType.TREASURE_HUNT_ICON_PICKUP);

            GameCore.Activities.Components.CloseOnReceive <OnHuntCompleted> activity5 = new GameCore.Activities.Components.CloseOnReceive <OnHuntCompleted>(Ports.Gameplay);
            GameCore.Activities.Components.CloseOnReceive <OnHuntContinued> activity6 = new GameCore.Activities.Components.CloseOnReceive <OnHuntContinued>(Ports.Gameplay);
            CoinCollected          item11 = new CoinCollected(base.Event, base.Entrant);
            OverrideVehicleControl item12 = new OverrideVehicleControl(base.Entrant.Opponent.Vehicle, OverrideVehicleControl.Control.Coast);
            OverrideVehicleControl item13 = new OverrideVehicleControl(base.Entrant.Opponent.Vehicle, OverrideVehicleControl.Control.Release);
            ChangeBlackBoard       item14 = new ChangeBlackBoard(BlackBoardChannel.kBlackBoard_AI, 331198907u);
            DisconnectFromRoaming  item15 = new DisconnectFromRoaming();

            state.EnterActivity.Activities.Add(item4);
            state.EnterActivity.Activities.Add(item2);
            state.EnterActivity.Activities.Add(item3);
            state.Transitions.Add(new Transition("hunting"));
            state2.Transitions.Add(new Transition(activity));
            state2.Transitions.Add(new Transition("collected", activity2));
            state2.Transitions.Add(new Transition("done", activity3));
            state3.EnterActivity.Activities.Add(item4);
            state3.EnterActivity.Activities.Add(item10);
            state3.Transitions.Add(new Transition("huntover", activity5));
            state3.Transitions.Add(new Transition("hunting", activity6));
            state3.ExitActivity.Activities.Add(item11);
            state4.EnterActivity.Activities.Add(item15);
            state4.EnterActivity.Activities.Add(item12);
            state4.EnterActivity.Activities.Add(item14);
            state4.EnterActivity.Activities.Add(item5);
            state4.EnterActivity.Activities.Add(new Timer(new InArgument <float>(() => 3f)));
            state4.EnterActivity.Activities.Add(item6);
            state4.Transitions.Add(new Transition("done", activity4));
            state4.ExitActivity.Activities.Add(item9);
            state4.ExitActivity.Activities.Add(item7);
            state4.ExitActivity.Activities.Add(item8);
            state4.ExitActivity.Activities.Add(item13);
            stateGraph.InitialState = "initial";
            stateGraph.DoneState    = "done";
            stateGraph.States.Add(state);
            stateGraph.States.Add(state2);
            stateGraph.States.Add(state3);
            stateGraph.States.Add(state4);
            stateGraph.States.Add(item);
            return(stateGraph);
        }
Ejemplo n.º 12
0
    public void LoadCoin()
    {
        CoinCollected data = SaveSystem.LoadCoin();

        totalCoin = data.coinCollected;
    }
Ejemplo n.º 13
0
 public static void DispatchCoinCollected(int value)
 {
     CoinCollected?.Invoke(value);
 }