You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
775 B

using System;
using Unity.Netcode;
using Unity.VisualScripting;
using UnityEngine;
using Object = UnityEngine.Object;
namespace Game {
public class GameManager : NetworkBehaviour {
public Object ballPrefab;
public Object playerPrefab;
private void Start() {
//var ball = Instantiate(ballPrefab, Vector2.zero, Quaternion.identity).GetComponent<Ball>();
var ball = FindObjectOfType(typeof(Ball));
var rb = ball.GetComponent<Rigidbody2D>();
rb.velocity = new Vector2(0, 10);
var p1 = Instantiate(playerPrefab, new Vector2(0, BorderSize.Singleton.y1), Quaternion.identity);
var p2 = Instantiate(playerPrefab, new Vector2(0, BorderSize.Singleton.y2), Quaternion.identity);
p1.AddComponent<AIPlayer>();
p2.AddComponent<RealPlayer>();
}
}
}