本文整理汇总了C#中PhysicsObject.calcRadius方法的典型用法代码示例。如果您正苦于以下问题:C# PhysicsObject.calcRadius方法的具体用法?C# PhysicsObject.calcRadius怎么用?C# PhysicsObject.calcRadius使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysicsObject
的用法示例。
在下文中一共展示了PhysicsObject.calcRadius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
private void Start()
{
StarRangeIncr = maxStarRange * 2;
RockPlanetRangeIncr = maxRockPlanetRange * 2;
RockMoonRangeIncr = maxRockMoonRange * 2;
GasGiantRangeIncr = maxGasGiantRange * 2;
GGMoonRangeIncr = maxGGMoonRange * 2;
objectsInSimulation = new PhysicsObject(Vector2.zero, 0, PhysicsObjectType.GALAXY, random.Next(0, 360));
objectsInSimulation.addComponent(smbh_phy);
GameObject blackHole = GameObject.Instantiate(superMassiveBlackHole, Vector3.zero, Quaternion.LookRotation(Vector3.left)) as GameObject;
blackHole.transform.parent = theCore.transform;
// add stars
starCount = random.Next (maxNumStars - minNumStars + 1) + minNumStars;
int tempMinStarRange = minStarRange;
int tempMaxStarRanger = maxStarRange;
for (int i = 0; i < starCount; i++)
{
minStarRange += StarRangeIncr;
maxStarRange += StarRangeIncr;
randX = random.Next ((maxStarRange * -1), maxStarRange);
while (randX > (minStarRange * -1) && randX < minStarRange)
{
randX = random.Next ((maxStarRange * -1), maxStarRange);
}
randY = random.Next ((maxStarRange * -1), maxStarRange);
while (randY > (minStarRange * -1) && randY < minStarRange)
{
randY = random.Next ((maxStarRange * -1), maxStarRange);
}
star_phy = new PhysicsObject(new Vector2(blackHole.transform.position.x + randX, blackHole.transform.position.y + randY), 11, PhysicsObjectType.STAR, random.Next(0,360));
star_phy.calcRadius(smbh_phy);
smbh_phy.addComponent(star_phy);
objectsInSimulation.addComponent (star_phy);
GameObject starSystem = Instantiate(stars[UnityEngine.Random.Range(0, stars.Length)], new Vector3(star_phy.Position.x, 0, star_phy.Position.y), Quaternion.LookRotation(Vector3.left)) as GameObject;
starSystem.transform.parent = theCore.transform;
starSystem.GetComponent<rotate>().myObject = star_phy;
star_phy.rotateScript = starSystem.GetComponent<rotate>();
//add rock planets to the stars
rockPlanetCount = random.Next (maxNumRockPlanetsPerStar - minNumRockPlanetsPerStar + 1) + minNumRockPlanetsPerStar;
int tempMinRPRange = minRockPlanetRange;
int tempMaxRPRange = maxRockPlanetRange;
for (int j = 0; j < rockPlanetCount; j++)
{
minRockPlanetRange += RockPlanetRangeIncr;
maxRockPlanetRange += RockPlanetRangeIncr;
// calculate randX between two ranges on equadistant sides of the centre
randX = random.Next ((maxRockPlanetRange* -1), maxRockPlanetRange);
while (randX > (minRockPlanetRange* -1) && randX < minRockPlanetRange) {
randX = random.Next ((maxRockPlanetRange* -1), maxRockPlanetRange);
}
// same for randY
randY = random.Next ((maxRockPlanetRange* -1), maxRockPlanetRange);
while (randY > (minRockPlanetRange* -1) && randY < minRockPlanetRange) {
randY = random.Next ((maxRockPlanetRange* -1), maxRockPlanetRange);
}
// create the planet then add it to the parent (star in this case) then add it to the objects the sim tracks
rockPlanet_phy = new PhysicsObject(new Vector2(randX + star_phy.Position.x, randY + star_phy.Position.y), 222, PhysicsObjectType.ROCK_PLANET, random.Next(0, 360));
rockPlanet_phy.calcRadius (star_phy);
star_phy.addComponent (rockPlanet_phy);
objectsInSimulation.addComponent(rockPlanet_phy);
GameObject RockPlanet = Instantiate(rockPlanets[UnityEngine.Random.Range(0, rockPlanets.Length - 1)], new Vector3(rockPlanet_phy.Position.x, 0, rockPlanet_phy.Position.y), Quaternion.LookRotation(Vector3.left)) as GameObject;
RockPlanet.transform.parent = starSystem.transform;
rockPlanet_phy.rotateScript = RockPlanet.GetComponent<rotate>();
RockPlanet.GetComponent<rotate>().myObject = rockPlanet_phy;
//add moons to the rock planets
rockMoonCount = random.Next (maxNumMoonsPerRockPlanet - minNumMoonsPerRockPlanet + 1) + minNumMoonsPerRockPlanet;
int tempMinRMRange = minRockMoonRange;
int tempMaxRMRange = maxRockMoonRange;
for (int k = 0; k < rockMoonCount; k++)
{
minRockMoonRange += RockMoonRangeIncr;
maxRockMoonRange += RockMoonRangeIncr;
randX = random.Next ((maxRockMoonRange* -1), maxRockMoonRange);
while (randX > (minRockMoonRange* -1) && randX < minRockMoonRange)
{
randX = random.Next ((maxRockMoonRange* -1), maxRockMoonRange);
}
randY = random.Next ((maxRockMoonRange* -1), maxRockMoonRange);
while (randY > (minRockMoonRange* -1) && randY < minRockMoonRange)
{
randY = random.Next ((maxRockMoonRange* -1), maxRockMoonRange);
}
//.........这里部分代码省略.........