Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello. I tried to fix for play mode a lot of time but I have error in 👍 Assets/MyAssets/Scripts/PlayerManager.cs(140,15): error CS1022: Type or namespace definition, or end-of-file expected #78

Open
aymanekoraiban opened this issue Sep 1, 2024 · 0 comments
Labels

Comments

@aymanekoraiban
Copy link

using System;
using System.Collections.Generic;
using UnityEngine;

public class PlayerManager : MonoBehaviour
{

[HideInInspector]
public List collectedFood;
private GameManager _GameManager;
private CanvasUiManager _CanvasUiManager;
public float cashCollectAnimDuration, moneySpriteAnimSpeed, moneySpriteScaleAnimDuration;
public int moneyUiVibrate;
public Vector3 scaleValue;
public GameObject moneySprite;
public Transform moneyUiPos;
private bool canAnimate = true;

private void Start()
{

    _CanvasUiManager = FindObjectOfType<CanvasUiManager>();
    _GameManager = FindObjectOfType<GameManager>();
    }

}

public class MonoBehaviour
{
}

internal class _CanvasUiManager
{
}

private void OnTriggerStay(Collider other)
{
    if (other.gameObject.CompareTag("Table"))
    {
        Table table = other.GetComponent<Table>();
        print("Check");
        if (table.isFull)
        {
            int i = -1;
            for (int k = collectedFood.Count - 1; k >= 0; k--)
            {
                if (!table.isFoodDelivered)
                {
                    i++;
                    if (collectedFood[k].foodName == table.orderedFoodName)
                    {
                        collectedFood[k].PayCash(table.tableTopTramsform);
                        FindObjectOfType<AudioManager>().Play("FoodServe");

                        table.isFoodDelivered = true;

                        collectedFood.Remove(collectedFood[k]);

                        for (int j = k; j < collectedFood.Count; j++)
                        {
                            collectedFood[j].DownYPose();
                        }
                        break;
                    }
                }
            }
        }
    }
}

private void print(global::System.String v)
{
}

Tweener tweener;

public PlayerManager()
{
}

private void OnTriggerEnter(Collider other)
{
    if (other.gameObject.CompareTag("BuyPoint"))
    {
        print("BuyPointEnter");
        other.GetComponent<BuyPoint>().StartSpend();
    }

    if (other.gameObject.CompareTag("Money"))
    {
        other.gameObject.tag = "Untagged";
        FindObjectOfType<AudioManager>().Play("MoneyCollect");

        other.transform.DOMove(transform.position, cashCollectAnimDuration)
        .OnComplete(delegate ()
        {
            Destroy(other.gameObject);

            Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);

            GameObject moneySp = Instantiate(moneySprite, pos, Quaternion.Euler(0, 0, 0));
            moneySp.transform.parent = _CanvasUiManager.transform;

            tweener = moneySp.transform.DOMove(moneyUiPos.position, moneySpriteAnimSpeed)
            .OnComplete(delegate ()
            {
                _GameManager.AddMoney(2);
                print("Money");
                if (canAnimate)
                {
                    canAnimate = false;
                    moneyUiPos.DOPunchScale(scaleValue, moneySpriteScaleAnimDuration, moneyUiVibrate)
                    .OnComplete(delegate ()
                    {
                        canAnimate = true;

                    });
                }

                Destroy(moneySp);
            });
        });
    }

    if (other.gameObject.CompareTag("WaiterSpawner"))
    {
        other.GetComponent<WaiterSpawner>().buyWaiterMenu.SetActive(true);
        other.GetComponent<WaiterSpawner>().CheckButtonActive();
    }
}

private void OnTriggerExit(Collider other)
{
    if (other.gameObject.CompareTag("BuyPoint")) ;
    other.GetComponent<BuyPoint>().StopSpend();

        if (other.gameObject.CompareTag("WaiterSpawner"))
            other.GetComponent<WaiterSpawner>().buyWaiterMenu.SetActive(false);
            }
          }

public PlayerManager()
{
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants