This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void obtainScreenBounds() { | |
float cameraToPlayerDistance = Mathf.Abs(Camera.mainCamera.transform.position.z - transform.position.z); | |
minScreenBounds = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, cameraToPlayerDistance)); | |
maxScreenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, cameraToPlayerDistance)); | |
} | |
private void checkScreenBoundaries() { | |
transform.position = new Vector3( | |
Mathf.Clamp(transform.position.x, (minScreenBounds.x) + 1, (maxScreenBounds.x) - 1), | |
Mathf.Clamp(transform.position.y, (minScreenBounds.y) + 1, (maxScreenBounds.y) - 1), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player.transform.position = new Vector3( | |
Mathf.Clamp(player.transform.position.x, -8.0f, 8.0f), | |
Mathf.Clamp(player.transform.position.y, -10.0f, 10.0f), | |
player.transform.position.z); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Color[] flashColors; | |
private float flashLerpDuration = 0.10f; | |
private float flashInvokeDuration = 0.5f; | |
void Start() { | |
// All other initialization code here... | |
flashColors = new Color[2]; | |
flashColors[0] = Color.magenta; | |
flashColors[1] = Color.white; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public EnemyBullet bullet; | |
private void fireBullet() { | |
EnemyBullet enemyBullet = Instantiate(bullet, gun.position, gun.rotation) as EnemyBullet; | |
enemyBullet.setSpeed(speed + BULLET_SPEED_MULTIPLIER); | |
laser.Play(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Start() { | |
speed = 15.0f; | |
// Other code here... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Transform bullet; | |
private void fireBullet() { | |
Transform gameObject = Instantiate(bullet, gun.position, gun.rotation) as Transform; | |
gameObject.GetComponent<EnemyBullet>().setSpeed(speed + BULLET_SPEED_MULTIPLIER); | |
laser.Play(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BasicEntityCollision : IEntityCollision { | |
private Vector3 size; | |
private Vector3 center; | |
// Give a bit of space between the raycast and boxCollider to prevent ray going through collision layer. | |
private float skin = .005f; | |
private LayerMask collisionMask; | |
private LayerMask playerMask; | |
public bool OnGround { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace com.mindshaft.test { | |
public class DefaultParamTest : MonoBehaviour { | |
void Update() { | |
DefaultParamTest(); | |
} | |
private void DefaultParamTest(int param = 0) { | |
Debug.Log("param: " + param); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_) | |
//Permission is hereby granted, free of charge, to any person obtaining a copy | |
//of this software and associated documentation files (the "Software"), to deal | |
//in the Software without restriction, including without limitation the rights | |
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
//copies of the Software, and to permit persons to whom the Software is | |
//furnished to do so, subject to the following conditions: | |
//The above copyright notice and this permission notice shall be included in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class UnityBulkReplaceTool : MonoBehaviour | |
{ | |
public GameObject objectToReplace = null; | |
public GameObject objectToSpawn = null; |
OlderNewer