private Vector3 CalculatePursuerForce() { var pursuerForce = Vector3.zero; if (this.tag == "Player") { var dir = (closestTag("Respawn").transform.position - transform.position).normalized; var desiredVel = dir.normalized * Mathf.Min(dir.magnitude, 5); var actualVelocity = rb.velocity; var force = (desiredVel - actualVelocity) / Parameters.T; pursuerForce = force * 2 + CalculateAgentForce() / 5 + CalculateWallForce(); if (pursuerForce != Vector3.zero) { return(pursuerForce); } else { return(Vector3.zero); } } else { var dir = (transform.position - closestTag("Player").transform.position).normalized; var desiredVel = dir.normalized * Mathf.Min(dir.magnitude, 5); var actualVelocity = rb.velocity; var force = (desiredVel - actualVelocity) / Parameters.T; pursuerForce = force * 2 + CalculateAgentForce() / 5 + CalculateWallForce(); //Avoid Corner var wallForce = Vector3.zero; foreach (var n in adjacentWalls) { if (!WallManager.IsWall(n)) { continue; } if ((transform.position - n.transform.position).magnitude > 2f) { continue; } var tempW = Vector3.zero - transform.position; var tangentW = Vector3.Cross(Vector3.up, tempW); var desiredVelW = 5 * tangentW.normalized * Mathf.Min(tangentW.magnitude, 5); var actualVelocityW = rb.velocity; wallForce = mass * (desiredVelW - 10 * actualVelocityW) / Parameters.T + CalculateGoalForce(maxSpeed: 5); } if (pursuerForce != Vector3.zero) { return(pursuerForce + wallForce); } else { return(Vector3.zero); } } }
public void OnCollisionEnter(Collision collision) { if (WallManager.IsWall(collision.gameObject)) { perWalls.Add(collision.gameObject, collision.contacts[0].point); } }
// Use this for initialization void Awake() { _3DRoot = GameObject.Find("3D Root"); wallGenerator = _3DRoot.GetComponent <WallGenerator>(); isoCam = _3DRoot.transform.Find("Isocam").gameObject as GameObject; player = _3DRoot.transform.Find("Player").gameObject as GameObject; _3DRoot.SetActive(false); _2DRoot = GameObject.Find("2D Root"); wallManager = GameObject.Find("2DManager").GetComponent <WallManager>(); //_2DRoot = GameObject.Find("2D Root"); //_3DRoot = GameObject.Find("3D Root"); mainMenuScrollView = GameObject.Find("Main Menu Scroll View"); submenu = GameObject.Find("Sub Menu"); itemNames = new string[] { "windows & door", "table", "bed", "chair" }; windowsanddoorNames = new string[] { "door1", "door2", "window1", "window2" }; tableNames = new string[] { "simple", "square", "long", "side", "oval", "stylish", "metallic", "coffeetop" }; //cupboardNames = new string[] { "wooden", "metal", "glass", "circle" }; bedNames = new string[] { "simple", "lowered", "side-table", "double-table" }; chairNames = new string[] { "red", "wooden", "round" }; _3DUIRoot = transform.Find("3D UI Root"); _2DUIRoot = transform.Find("2D UI Root"); _3DUIRoot.gameObject.SetActive(false); }
public void OnCollisionExit(Collision collision) { if (WallManager.IsWall(collision.gameObject)) { perWalls.Remove(collision.gameObject); } }
private void init(bool fullRegen = false) { Vector3 min = new Vector3(0, Constants.HUD_OFFSET, 0f); Vector3 max = new Vector3(Constants.RESOLUTION_X, Constants.RESOLUTION_Y, 0f); this.boundary = new BoundingBox(min, max); this.rand = new Random(); PositionGenerator.getInstance().init(this.rand); SpawnGenerator.getInstance().SpawnRequests.Clear(); if (StateManager.getInstance().GameMode == GameMode.OnePlayer) { this.playerOne = new Snake(this.content, Constants.HEADING_UP, 0f, ConfigurationManager.getInstance().PlayerOnesControls); } else { this.playerOne = new Snake(this.content, Constants.HEADING_UP, 100f, ConfigurationManager.getInstance().PlayerOnesControls); this.playerTwo = new Snake(this.content, Constants.HEADING_UP, -100f, ConfigurationManager.getInstance().PlayerTwosControls); } if (fullRegen) { this.backGround = new BackGround(this.content); this.hud = new HUD(this.content); this.foodManager = new FoodManager(content, this.rand); this.portals = new PortalManager(content, this.rand); this.walls = new WallManager(content, this.rand); } #if DEBUG this.debugLine = LoadingUtils.load <Texture2D>(this.content, "Chip"); #endif }
// Update is called once per frame void Update() { CameraManager cm = FindObjectOfType <CameraManager>(); WallManager wm = FindObjectOfType <WallManager>(); Ball ball = FindObjectOfType <Ball>(); switch (state) { case State.Play: if (wm.IsEnd()) { ball.StopMove(); cm.ZoomOut(); wm.Destroy(); state = State.ZoomingOut; } break; case State.ZoomingOut: if (!cm.IsZoomingOut()) { ball.StartMove(); state = State.Play; wm.GenerateWall(); } break; } }
public void OnCollisionEnter(Collision collision) { if (WallManager.IsWall(collision.gameObject)) { touchedWalls.Add(collision.gameObject); } }
// Start is called before the first frame update void Start() { _wallManagerScript = GameObject.FindWithTag("WallController").GetComponent <WallManager>(); _anim = GetComponent <Animator>(); _timer = _timerMax; _newSoundManagerScript = NewSoundManager.instance; }
private Vector3 CalculateWallForce() { var wallForce = Vector3.zero; if (count < 2) { return(wallForce); } foreach (var n in adjacentWalls) { if (!WallManager.IsWall(n)) { continue; } var dir = (transform.position - n.transform.position).normalized; var overlap = (radius + 0.5f) - Vector3.Distance(transform.position, n.transform.position); var tangent = Vector3.Cross(Vector3.up, dir); wallForce += Parameters.A * Mathf.Exp(overlap / Parameters.B) * dir; wallForce += Parameters.k * Mathf.Max(overlap, 0) * dir; wallForce -= Parameters.Kappa * (overlap > 0f ? overlap : 0) * Vector3.Dot(rb.velocity, tangent) * tangent; } return(wallForce); }
/* Draw a wall between current point and the last point by specifying a mesh with 4 vertices */ void drawWall(Vector3 point1, Vector3 point2) { GameObject wall = Instantiate(wallPrefab); wallManager.addChild(wall); WallManager.getWall(wall).drawWall(point1, point2, measurer.getWallHeight()); }
private void Start() { Status = PaddleStatus.None; float[] wallBounds = WallManager.CalculateVerticalLeftAndRightWrapBounds(ColliderLength); xLeftWrapBound = wallBounds[0]; xRightWrapBound = wallBounds[1]; // xLeftWrapBound = WallManager.StaticInstance.LeftMostVertical; // xRightWrapBound = WallManager.StaticInstance.RightMostVertical; }
private void Start() { wallManager = FindObjectOfType <WallManager>(); infoSource = GetComponent <ValueClamp>(); if (infoSource) { infoSource.onValueChange += ChangeColors; } }
// Update is called once per frame void Update() { rb2D.MovePosition(rb2D.position + Direction * Speed * Time.fixedDeltaTime); //Once wall leaves screen, destroy it if (transform.position.x < Util.GetBottomLeft().x || transform.position.x > Util.GetTopRight().x || transform.position.y < Util.GetBottomLeft().y || transform.position.y > Util.GetTopRight().y) { WallManager.RemoveWall(this); Destroy(this.gameObject); } }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); var ballTexture = Content.Load <Texture2D>(ASSET_NAME_BALL); _ball = new BallEntity(ballTexture, new Vector2(BALL_POS_X, BALL_POS_Y)); _ballManager = new BallManager(_ball); var groundTexture = Content.Load <Texture2D>(ASSET_NAME_GROUND); _groundManager = new GroundManager(groundTexture, _ball, _entityManager); _ballInputController = new BallInputController(_ball); _scoreBoardFont = Content.Load <SpriteFont>(ASSET_NAME_SCORE_BOARD_FONT); _scoreBoard = new ScoreBoardEntity(_scoreBoardFont, new Vector2(SCORE_BOARD_POS_X, SCORE_BOARD_POS_Y), _ball); var wallTexture = Content.Load <Texture2D>(ASSET_NAME_WALL); _wallManager = new WallManager(wallTexture, _ball, _scoreBoard, _entityManager); _coinPickupSoundEffect = Content.Load <SoundEffect>(ASSET_NAME_COIN_PICKUP); _rotatingCoinAnimation = new TextureAnimation(); _coin0 = Content.Load <Texture2D>(ASSET_NAME_COIN_0); _coin1 = Content.Load <Texture2D>(ASSET_NAME_COIN_1); _coin2 = Content.Load <Texture2D>(ASSET_NAME_COIN_2); _coin3 = Content.Load <Texture2D>(ASSET_NAME_COIN_3); _coin4 = Content.Load <Texture2D>(ASSET_NAME_COIN_4); _rotatingCoinAnimation.AddFrame(_coin0, ROTATING_COIN_ANIMATION_FRAME_DURATION); _rotatingCoinAnimation.AddFrame(_coin1, ROTATING_COIN_ANIMATION_FRAME_DURATION * 2); _rotatingCoinAnimation.AddFrame(_coin2, ROTATING_COIN_ANIMATION_FRAME_DURATION * 3); _rotatingCoinAnimation.AddFrame(_coin3, ROTATING_COIN_ANIMATION_FRAME_DURATION * 4); _rotatingCoinAnimation.AddFrame(_coin4, ROTATING_COIN_ANIMATION_FRAME_DURATION * 5); _rotatingCoinAnimation.Play(); _coinManager = new CoinManager(_coin0, _ball, _scoreBoard, _entityManager, _coinPickupSoundEffect, _rotatingCoinAnimation); _entityManager.AddEntity(_ball); _entityManager.AddEntity(_ballManager); _entityManager.AddEntity(_groundManager); _entityManager.AddEntity(_scoreBoard); _entityManager.AddEntity(_wallManager); _entityManager.AddEntity(_coinManager); _groundManager.Initialize(); }
private float rotationSpeed; // 회전속도 // 초기화 private void Awake() { if (instance == null) { instance = this; } orbits = GetComponentsInChildren <Orbit>(); rotationSpeed = originalRotationSpeed; }
public void OnTriggerEnter(Collider other) { if (PEManager.IsAgent(other.gameObject)) { perceivedNeighbors.Add(other.gameObject); } if (WallManager.IsWall(other.gameObject) || other.CompareTag("wall")) { adjacentWalls.Add(other.gameObject); } }
// Start is called before the first frame update private void Awake() { theWalls = new GameObject[transform.childCount]; _wallManagerScript = GameObject.FindWithTag("WallController").GetComponent <WallManager>(); _thisWallChange = GetComponent <WallChange>(); for (int i = 0; i < theWalls.Length; i++) { theWalls[i] = transform.GetChild(i).gameObject; } }
// Use this for initialization void Start() { mapManager = FindObjectOfType <MapManager>(); view = transform.GetComponent <PhotonView>(); GameObject angel = GameObject.Find("angelStatue"); goalManager = angel.GetComponent <WallManager>(); teamManager = FindObjectOfType <TeamManager>(); }
public void OnTriggerEnter(Collider other) { if (AgentManager.IsAgent(other.gameObject)) { perceivedNeighbors.Add(other.gameObject); } if (WallManager.IsWall(other.gameObject)) { adjacentWalls.Add(other.gameObject); } }
private void Awake() { gameObject.layer = 15; //récupération des scripts _arenaRotationScript = arena.GetComponent <ArenaRotation>(); _wallManagerScript = GameObject.FindWithTag("WallController").GetComponent <WallManager>(); _gameManagerScript = GameObject.FindWithTag("GameController").GetComponent <GameManager>(); _scoreManagerScript = GameObject.FindWithTag("GameController").GetComponent <ScoreManager>(); _faceClassScript = GameObject.FindWithTag("GameController").GetComponent <FaceClass>(); _wallProprieties = GetComponent <WallProprieties>(); _newSoundManagerScript = NewSoundManager.instance; }
// Use this for initialization void Start() { mapManager = FindObjectOfType <MapManager>(); view = transform.GetComponent <PhotonView>(); if (mode == GameMode.DestroyObjective) { GameObject angel = GameObject.Find("angelStatue"); goalManager = angel.GetComponent <WallManager>(); } teamManager = FindObjectOfType <TeamManager>(); }
// Use this for initialization void Start() { GameObject _gameCtrl = GameObject.Find("GameCtrl"); _inputManager = _gameCtrl.GetComponent <InputManager>(); _gameManager = _gameCtrl.GetComponent <GameManager>(); _wallManager = _gameManager._wallManager; _collider = gameObject.GetComponent <Collider> (); myBallState = BallState.DEFAULT; defaultPosition = this.transform.position; rigid = this.GetComponent <Rigidbody>(); }
void OnTriggerEnter2D(Collider2D c) { Ball ball = c.GetComponent <Ball> (); if (ball != null) { Ball.ResetAndPositionAt( BallManager.StaticInstance.transform.parent.transform, ball, Vector3.zero ); WallManager.BallEnteredScoreZone(AttackingPlayer); } }
// Use this for initialization void Start() { //I'm dumb so I cheat string temp = upKey; upKey = downKey; downKey = temp; angleAllowance = 20; keyPressed = false; upPressed = false; downPressed = false; //Getting the wall manager script. wm = GameObject.Find("WallManagerGO").GetComponent <WallManager>(); }
// Start is called before the first frame update void Start() { TurretManager turrets = Instantiate(turretManager, transform); turrets.name = "TurretManager"; hordes = Instantiate(hordeManager, transform); hordes.name = "HordeManager"; GridManager grid = Instantiate(gridManager, transform); grid.name = "GridManager"; WallManager walls = Instantiate(wallManager, transform); walls.name = "WallManager"; SpawnWave(waveCount); }
private void ButtonPost_Click(object sender, EventArgs e) { string postText = TextBoxPostText.Text; if (postText != string.Empty && postText != k_PostToWallMsg) { try { WallManager.PostToWall(User, postText); } catch (Exception exception) { MessageBox.Show(exception.Message); } } else { MessageBox.Show(k_ErrorMsgEmptyText); } }
public void OnTriggerEnter(Collider other) { if (AgentManager.IsAgent(other.gameObject)) { // print("agent added"+other.gameObject.name); perceivedNeighbors.Add(other.gameObject); } else if (WallManager.IsWall(other.gameObject) || other.gameObject.name.Substring(0, 4) == "Wall" || other.gameObject.name.Substring(0, 4) == "Cube") { // print("wall added"+other.gameObject.name); perceivedWalls.Add(other.gameObject); } else { // print("unknown found "+other.gameObject.name); } }
private void loginForm_LoginSucess(User i_LoggedUser) { InitializeComponent(); m_AppController = new AppController() { User = i_LoggedUser }; m_AlbumsManager = new AlbumsManager(m_AppController.User); m_WallManager = new WallManager(m_AppController.User.WallPosts); m_FilesUploader = new FilesUploader(); m_FaceRideManager = new FaceRideManager(); if (m_FirstLaunch) { m_FirstLaunch = false; ShowDialog(); } else { Show(); } }
private Vector3 CalculateWallForce() { var wallForce = Vector3.zero; foreach (var wall in touchedWalls) { if (!WallManager.IsWall(wall)) { continue; } var dir = (transform.position - wall.transform.position).normalized; var radiusDiff = (radius) - Vector3.Distance(transform.position, wall.transform.position); var proximityForce = Parameters.WALL_A * Mathf.Exp(radiusDiff / Parameters.WALL_B) * dir; var repulsionForce = Parameters.WALL_k * (radiusDiff > 0f ? radiusDiff : 0) * dir; var slidingForce = Parameters.WALL_Kappa * (radiusDiff > 0f ? radiusDiff : 0) * Vector3.Dot(rb.velocity, Vector3.Cross(Vector3.up, dir)) * Vector3.Cross(Vector3.up, dir); wallForce = proximityForce + repulsionForce - slidingForce; } return(wallForce); }
void DestroyAllChildren(WallManager _manager) { GameObject _parent = _manager.geometrySpawner; Transform[] childrenT = _parent.GetComponentsInChildren<Transform>(); List<GameObject> childrenG = new List<GameObject>(); foreach (Transform child in childrenT) { childrenG.Add(child.gameObject); } // remove parent of list (manager) childrenG.Remove(_parent); foreach (GameObject child in childrenG) { DestroyImmediate(child); } // deestroy any enterances _parent = _manager.enteranceSpawnPoint.gameObject; childrenT = _parent.GetComponentsInChildren<Transform>(); childrenG = new List<GameObject>(); foreach (Transform child in childrenT) { childrenG.Add(child.gameObject); } // remove parent of list (manager) childrenG.Remove(_parent); foreach (GameObject child in childrenG) { DestroyImmediate(child); } }
private void Awake() { _scoreManagerScript = GetComponent <ScoreManager>(); _faceClassScript = GetComponent <FaceClass>(); _arenaRotationScript = arena.GetComponent <ArenaRotation>(); _wallManagerScript = GameObject.FindWithTag("WallController").GetComponent <WallManager>(); menuInfoMouvementBool = new bool[4]; if (GameObject.FindWithTag("MenuManager") != null) { _menuInformationScript = GameObject.FindWithTag("MenuManager").GetComponent <GetMenuInformation>(); //permet de set les controles et d'instantier les personnages joueurs en fonction du nombre de joueurs if (_menuInformationScript != null && playerList.Count > 0) { _scoreManagerScript.nbrPlayers = 0; for (int i = playerList.Count; i-- > 0;) { playerList[i].SetActive(false); } playerList.Clear(); } for (int i = 0; i < _menuInformationScript.numbersOfPlayers; i++) { GameObject playerInstantiation = Instantiate(playerPrefabs[i]); playerList.Add(playerInstantiation); _scoreManagerScript.nbrPlayers++; } for (int i = 0; i < _menuInformationScript.getPlayerMouvementMode().Length; i++) { menuInfoMouvementBool[i] = _menuInformationScript.getPlayerMouvementMode()[i]; } } playersEntityScripts = new PlayerEntity[playerList.Count]; attackTestScripts = new AttackTest[playerList.Count]; playerMax = playerList.Count; currentPlayersOnArena = playerMax; for (int i = playerList.Count; i-- > 0;) { currentPlayersList.Add(playerList[i]); } if (playerList.Count == 2) { wallHitObj[0].SetActive(false); wallHitObj[1].SetActive(false); playerUISprite[2].SetActive(false); playerUISprite[3].SetActive(false); CracksObj[2].SetActive(false); CracksObj[3].SetActive(false); } else if (playerList.Count == 3) { CracksObj[3].SetActive(false); wallHitObj[1].SetActive(false); playerUISprite[3].SetActive(false); } }