void OnGUI() { EditorGUILayout.BeginVertical("ShurikenEffectBg"); typeOfPlayer = (AFPC_PlayerMovement.PlayerType)EditorGUILayout.EnumPopup("Type Of Player: ", typeOfPlayer, "ExposablePopupMenu"); playerPlatform = (PlayerPlatform)EditorGUILayout.EnumPopup("Platform: ", playerPlatform, "ExposablePopupMenu"); spawnPos = EditorGUILayout.Vector3Field("Player Spawn Position: ", spawnPos); if (typeOfPlayer == AFPC_PlayerMovement.PlayerType.rigidBodyPlayer) { footstepDetection = (AFPC_PlayerMovement.FootstepsDetectionMode)EditorGUILayout.EnumPopup("Footstep Detection Mode: ", footstepDetection, "ExposablePopupMenu"); } GUILayout.Box(GUIContent.none, "horizontalSlider"); if (GUILayout.Button("Build Player!")) { BuildPlayer(); } if (player != null) { groundDistance = EditorGUILayout.FloatField("Ground Distance: ", groundDistance); if (GUILayout.Button("Place On Ground")) { if (groundDistance > 0) { PutOnGround(groundDistance); } else { Debug.LogError("Set Ground Distance To Greater Than 0."); } } } EditorGUILayout.EndVertical(); }
private void StartGame() { //clear lists objects.Clear(); //adding new player player = new PlayerPlatform(0 + Constants.PLATFORM_OFFSET, gameCanvas.Size.Height / 2 - Constants.PLATFORM_HEIGHT / 2, Brushes.Blue, Constants.PLATFORM_WIDTH, Constants.PLATFORM_HEIGHT); objects.Add(player); //adding new enemy enemy = new EnemyPlatform(gameCanvas.Width - Constants.PLATFORM_WIDTH - Constants.PLATFORM_OFFSET, gameCanvas.Size.Height / 2 - Constants.PLATFORM_HEIGHT / 2, Brushes.Blue, Constants.PLATFORM_WIDTH, Constants.PLATFORM_HEIGHT); objects.Add(enemy); ball = new Ball(Constants.CANVAS_WIDTH / 2 - Constants.BALL_SIZE, Constants.CANVAS_HEIGHT / 2 - Constants.BALL_SIZE, Brushes.White, Constants.BALL_SIZE, Constants.BALL_SIZE, Constants.BALL_SPEED, Constants.BALL_SPEED); //set the ball for the enemy to see enemy.SetBall(ball); objects.Add(ball); Random r = new Random(); //create a few obstacles for (int i = 0; i < Constants.OBSTACLE_COUNT; i++) { objects.Add(Obstacle.GenerateObstacle(r.Next(Constants.OBSTACLE_MIN_SPAWN, Constants.OBSTACLE_MAX_SPAWN), r.Next(0 + Constants.PLATFORM_HEIGHT, Constants.CANVAS_HEIGHT - Constants.PLATFORM_HEIGHT))); } }
public void ChooseNewTarget() { int iRandom = Random.Range(0, 2); if (iRandom == 0) { PlayerPlatform tPlatform = FindObjectOfType <PlayerPlatform>(); if (tPlatform != null) { SetTarget(tPlatform.transform); } else { ChooseNewTarget(); } } else { Transform tPlayer = GetClosestPlayerObject(); if (tPlayer != null && tPlayer != transform) { SetTarget(tPlayer); } else { ChooseNewTarget(); } } //SetTarget(GetClosestAttackableObject()); }
private void Awake() { _doorMode = GetComponent <DoorAuthoring>(); _collider = GetComponent <BoxCollider>(); _platformAuthoring = GetComponent <PlatformAuthoring>(); _collider.isTrigger = true; _player = FindObjectOfType <PlayerPlatform>(); }
private void Awake() { if (instance != null && instance != this) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); }
private void StartGame() { //reset the stats new Stats(); //reset the lists objects.Clear(); alive.Clear(); bricks.Clear(); //place the platform at the bottom in the middle player = new PlayerPlatform(gameCanvas.Size.Width / 2 - Constants.PLATFORM_WIDTH / 2, gameCanvas.Size.Height - Constants.PLATFORM_HEIGHT, Brushes.Blue, Constants.PLATFORM_WIDTH, Constants.BRICK_HEIGHT); objects.Add(player); int topLineOffset = 30; //add lines of bricks for (int i = 0; i < Constants.BRICK_ROW_COUNT; i++) { for (int j = 0; j < Constants.BRICK_COUNT; j++) { bricks.Add(new Brick(j * Constants.BRICK_WIDTH, topLineOffset + (i * Constants.BRICK_HEIGHT), Brick.colors[i], Constants.BRICK_WIDTH, Constants.BRICK_HEIGHT)); } } objects.AddRange(bricks); // spawn a ball ball = new Ball(100, 100, Brushes.Black, 15, 15, 4, 4); // ball speed has to be one for precision as ints are used objects.Add(ball); gameScore.Text = Stats.Score.ToString(); //update the lives livesCount.Text = Stats.Lives.ToString(); }
private void Awake() { Instance = this; string modelName = XRDevice.model; if (modelName.StartsWith("Oculus")) { playerPlatform = PlayerPlatform.OCULUS; } else if (modelName.StartsWith("OpenVR") || modelName.StartsWith("HTC")) // TODO: remove whichever is wrong { playerPlatform = PlayerPlatform.STEAMVR; } else if (Application.isEditor) { playerPlatform = PlayerPlatform.EDITOR; } else { Debug.Log("Unhandled model: " + modelName); } }
public PlayerPlatformMapUnit(Map map, PlayerPlatform playerPlatform, Vector movementOffset) : base(map, playerPlatform, movementOffset) { this.playerPlatform = playerPlatform; }
void Start() { boxCollider = GetComponent <BoxCollider2D>(); circleCollider = GetComponent <CircleCollider2D>(); goodSpawn = GameObject.Find("EndSpawnBack"); groundCheck = transform.Find("groundCheck"); frontCheckTop = new GameObject("frontCheckTop"); frontCheckBot = new GameObject("frontCheckBot"); playerJump = GetComponent <PlayerJump>(); playerWall = GetComponent <PlayerWall>(); playerRun = GetComponent <PlayerRun>(); playerCrouch = GetComponent <PlayerCrouch>(); playerDash = GetComponent <PlayerDash>(); playerPlatform = GetComponent <PlayerPlatform>(); normalRotation = transform.localRotation; animator = GetComponent <Animator>(); pickup = GetComponent <Pickup>(); cam = GetComponentInChildren <CameraFollowFinal> (); came = GameObject.FindWithTag("MainCamera"); frontCheckTop.transform.parent = transform; frontCheckBot.transform.parent = transform; sG = (Resources.Load("Weapons/Sounds/ReloadShotgun")) as AudioClip; wG = (Resources.Load("Weapons/Sounds/ReloadWatergun")) as AudioClip; bulletPrefab = (Resources.Load("Weapons/Rocket/Player Bullet")) as GameObject; rocketKick = (Resources.Load("Weapons/WeaponKicks/RocketKick")) as GameObject; shotgunBullet = (Resources.Load("Weapons/Shotgun/ShotgunSpraySystem")) as GameObject; shotgunKick = (Resources.Load("Weapons/WeaponKicks/ShotgunKick")) as GameObject; staffBullet = (Resources.Load("Weapons/Staff/Fireball")) as GameObject; granadeBullet = (Resources.Load("Weapons/Granade/Granade2")) as GameObject; watergunBullet = (Resources.Load("Weapons/Watergun/WaterGunBullet")) as GameObject; watergunKick = (Resources.Load("Weapons/WeaponKicks/WatergunKick")) as GameObject; machinegunBullet = (Resources.Load("Weapons/Machinegun/MachineGunBullet")) as GameObject; machinegunKick = (Resources.Load("Weapons/WeaponKicks/MachinegunKick")) as GameObject; boomerangBullet = (Resources.Load("Weapons/Boomerang/Boomerang2")) as GameObject; power = (Resources.Load("Weapons/Staff/Power")) as GameObject; boom = (Resources.Load("Weapons/Staff/Boom")) as GameObject; Launch = (Resources.Load("Weapons/Sounds/DoodleRocketLaunch")) as AudioClip; shotgunShot = (Resources.Load("Weapons/Sounds/DoodleShotgunShot")) as AudioClip; staffShot = (Resources.Load("Weapons/Sounds/DoodleStaffShot")) as AudioClip; staffBoom = (Resources.Load("Weapons/Sounds/DoodleStaffSlam")) as AudioClip; granadeShot = (Resources.Load("Weapons/Sounds/DoodleGranadeThrow")) as AudioClip; watergunShot = (Resources.Load("Weapons/Sounds/DoodleWatergun")) as AudioClip; machinegunShot = (Resources.Load("Weapons/Sounds/DoodleMachinegunFire")) as AudioClip; boomerangShot = (Resources.Load("Weapons/Sounds/DoodleGranadeThrow")) as AudioClip; outOfAmmo = (Resources.Load("Weapons/Sounds/Click")) as AudioClip; fightButton = GameObject.Find("Fight"); fightButton.SetActive(false); //transform.position = ss.transform.position; if (spriteDirection == Direction.Right) { facingRight = true; } else { facingRight = false; Flip(); } }
static bool Prefix(UIElement __instance, Vector2 pos, string s, Color c, int true_rank, float scl = 0.5f, float alpha_scale = 1f, PlayerPlatform pp = PlayerPlatform.PC, float max_width = -1f) { float m_alpha = (float)AccessTools.Field(typeof(UIElement), "m_alpha").GetValue(__instance); float x = pos.x + 14f; if (max_width > -1f) { max_width -= pos.x - x; } __instance.DrawStringSmall(s, pos, scl, StringOffset.LEFT, c, m_alpha * alpha_scale, max_width); float num = UIManager.GetStringWidth(s, scl * 20f, 0, -1); if (max_width > -1f) { num = Mathf.Min(num, max_width); } return(false); }