Ejemplo n.º 1
0
        protected override void OnUpdating()
        {
            base.OnUpdating();

            if (!MapEvents.Any(obj => obj.IsUpdated))
            {
                foreach (MapObject item in Objects.Where(obj => obj is MapObject mapObject && (mapObject.GetGlobalPosition() - Player.Position).Length > 2500 && mapObject.IsUpdated))
                {
                    item.IsUpdated = false;
                    if (item.CollisionShape is PhysicalRectangleShape shape)
                    {
                        shape.IsActive = false;
                    }
                }

                foreach (MapObject item in Objects.Where(obj => obj is MapObject mapObject && (mapObject.GetGlobalPosition() - Player.Position).Length <= 2500 && !mapObject.IsUpdated))
                {
                    item.IsUpdated = true;
                    if (item.CollisionShape is PhysicalRectangleShape shape)
                    {
                        shape.IsActive = true;
                    }
                }
            }

            UpdateOtherPlayers();

            if (!SavePoints.Any(obj => obj.IsActive))
            {
                PhysicalWorld?.Update();
            }

            UpdateCollision();
        }
Ejemplo n.º 2
0
	// Use this for initialization
	void Start () {
		playerPoints = new ArrayList();
		if (pointsInstance == null) {
			pointsInstance = this;
			//DontDestroyOnLoad (gameObject);
			fileWay = Application.persistentDataPath + "/points.dat";
		} 
		else {
			Destroy (gameObject);
		}
	}
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     playerPoints = new ArrayList();
     if (pointsInstance == null)
     {
         pointsInstance = this;
         //DontDestroyOnLoad (gameObject);
         fileWay = Application.persistentDataPath + "/points.dat";
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 4
0
    private void Awake()
    {
        SavePoints         savePoints = new SavePoints();
        PlayerCurrentStats player     = savePoints.LoadPlayerStats();

        while (player == null)
        {
            player = savePoints.LoadPlayerStats();
            if (player != null)
            {
                break;
            }
        }

        gameDB = FindObjectOfType <GameDatabase>();
        //GetComponent<Player>().InitiatePlayerStats(GetDatabase().GetInitialPlayer());
        //GetComponent<Player>().EquipWeapon(GetDatabase().GetInitialSword(player.PlayerSwordIndex));
    }