本文整理汇总了C#中Critter类的典型用法代码示例。如果您正苦于以下问题:C# Critter类的具体用法?C# Critter怎么用?C# Critter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Critter类属于命名空间,在下文中一共展示了Critter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Activate
public void Activate(Critter newCritter)
{
if(hex){
critter = newCritter;
UpdateInfo();
}
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:7,代码来源:HexButton.cs
示例2: SetCritter
private void SetCritter()
{
if (!critter)
{
critter = FindObjectOfType<Player>().GetCritter();
}
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:7,代码来源:CritterEventEffects.cs
示例3: PopulateTokenSpriteOptions
public static List<Sprite> PopulateTokenSpriteOptions(Critter.locomotionType[] locomotions)
{
List<Sprite> finalSpriteList = new List<Sprite>();
Sprite[] currentList;
string itemLocation = "";
foreach (Critter.locomotionType locoType in locomotions)
{
itemLocation = CheckTokenImageLocationString(locoType);
currentList = Resources.LoadAll<Sprite>(itemLocation);
currentList = pUnlocksControl.GenerateUnlockedSpriteList(currentList);
foreach (Sprite item in currentList)
{
if (!finalSpriteList.Contains(item))
{
finalSpriteList.Add(item);
}
}
}
finalSpriteList.TrimExcess();
return finalSpriteList;
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:25,代码来源:GameController.cs
示例4: Activate
public void Activate(Critter newCritter, Hex newHab)
{
critter = newCritter;
habitat = newHab;
warnControl = FindObjectOfType<WarningsController>();
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:7,代码来源:WarningChecker.cs
示例5: Init
public static void Init(Critter ghost, bool firstTime)
{
if(firstTime)
{
// set max possible HP
ghost.Stat[Stats.MaxLife] = 9999;
ghost.Stat[Stats.CurrentHP] = 9999;
// and armor class
ghost.Stat[Stats.ArmorClass] = 90;
}
// syncronize ghost actual state with var value
if(ghost.Cond == Cond.Dead && GhostState == State.Alive )
{
ghost.ToLife();
}
else if(ghost.Cond != Cond.Dead && GhostState == State.Dead)
{
ghost.ToDead(Anim2.DeadBurnRun, null);
}
ghost.Attacked += _GhostAttacked;
ghost.Dead += _GhostDead;
ghost.Respawn += (self, e) => GhostState = State.Alive;
ghost.Stealing += _GhostStealing;
}
开发者ID:wladimiiir,项目名称:vault112,代码行数:26,代码来源:Ghost.cs
示例6: SetCritterTransformArray
public void SetCritterTransformArray(Critter sourceCritter) {
critter = sourceCritter;
critterDecorationsTest.critter = sourceCritter;
critterSegmentTransforms = new SegmentTransform[sourceCritter.critterSegmentList.Count]; // grab numSegments from Critter
for(int i = 0; i < sourceCritter.critterSegmentList.Count; i++) {
SegmentTransform segmentTransform;
segmentTransform.PX = sourceCritter.critterSegmentList[i].transform.position.x;
segmentTransform.PY = sourceCritter.critterSegmentList[i].transform.position.y;
segmentTransform.PZ = sourceCritter.critterSegmentList[i].transform.position.z;
segmentTransform.RX = sourceCritter.critterSegmentList[i].transform.rotation.x;
segmentTransform.RY = sourceCritter.critterSegmentList[i].transform.rotation.y;
segmentTransform.RZ = sourceCritter.critterSegmentList[i].transform.rotation.z;
segmentTransform.RW = sourceCritter.critterSegmentList[i].transform.rotation.w;
segmentTransform.SX = sourceCritter.critterSegmentList[i].transform.localScale.x / 2f;
segmentTransform.SY = sourceCritter.critterSegmentList[i].transform.localScale.y / 2f;
segmentTransform.SZ = sourceCritter.critterSegmentList[i].transform.localScale.z / 2f;
critterSegmentTransforms[i] = segmentTransform;
}
//Debug.Log("SetCritterTransformArray numSegments: " + critterSegmentTransforms.Length + ", BoundingBox: " + sourceCritter.BoundingBoxMinCorner.ToString() + " -> " + sourceCritter.BoundingBoxMaxCorner.ToString());
// Largest boundingBox dimension determines cellResolution?
GlobalBoundingBoxDimensions = (sourceCritter.BoundingBoxMaxCorner - sourceCritter.BoundingBoxMinCorner) * 1.15f; // buffer amount
GlobalBoundingBoxOffset = (sourceCritter.BoundingBoxMaxCorner + sourceCritter.BoundingBoxMinCorner) / 2f;
int approxChunksPerDimension = 5;
float avgRadius = (GlobalBoundingBoxDimensions.x + GlobalBoundingBoxDimensions.y + GlobalBoundingBoxDimensions.z) / 3f;
float chunkSize = avgRadius / (float)approxChunksPerDimension;
float cellSize = chunkSize / 8f;
cellResolution = cellSize;
}
开发者ID:eaclou,项目名称:Master_CreatureTrainer01,代码行数:31,代码来源:CritterMarchingCubes.cs
示例7: Mutate
/// <summary>
/// Mutates a critter
/// </summary>
/// <param name="child">
/// The critter that is to be mutated.
/// </param>
/// <returns>
/// A mutated critter.
/// </returns>
public Critter Mutate(Critter child)
{
var rand = Random.GetInstance();
double u1 = rand.NextDouble(); // these are uniform(0,1) random doubles
double u2 = rand.NextDouble();
double randStdNormal = Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2); // random no
int crossoverWeight = (int)Tools.Clamp(10 * randStdNormal, -30, 30);
child.DepartureTime = this.properties.DepartureTime.AddMinutes(crossoverWeight);
Assert.That(child.DepartureTime != default(DateTime));
var random = Random.GetInstance();
List<NodeWrapper<INetworkNode>> nodes = child.Route;
if (nodes.Count == 1)
{
return child;
}
int startIndex = random.Next(0, nodes.Count - 2);
int endIndex = random.Next(startIndex + 1, nodes.Count - 1);
NodeWrapper<INetworkNode> begin = nodes[startIndex];
NodeWrapper<INetworkNode> end = nodes[endIndex];
Route newSegment = this.properties.RouteGenerator.Generate(
begin.Node, end.Node);
var newRoute = new Route(Guid.NewGuid().GetHashCode());
newRoute.AddRange(nodes.GetRange(0, startIndex));
newRoute.AddRange(newSegment);
newRoute.AddRange(nodes.GetRange(endIndex + 1, nodes.Count - 1 - endIndex));
return new Critter((Route)newRoute.Clone(), new Fitness()) { DepartureTime = child.DepartureTime };
// return child;
}
开发者ID:NoxHarmonium,项目名称:rmitjourneyplanner,代码行数:43,代码来源:StandardMutator.cs
示例8: Awake
void Awake ()
{
crit = GetComponent<Critter>();
if (sfx == null)
sfx = GameObject.Find("Audio/AudioSFX").GetComponent<AudioSource>();
}
开发者ID:bartochnio,项目名称:Rytuol,代码行数:7,代码来源:GoatScript.cs
示例9: Activate
public void Activate(Critter newCritter)
{
critter = newCritter;
slotIcons = GetComponentsInChildren<UISlot>();
InitializeSlots(critter, slotType);
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:8,代码来源:TraitUIPanel.cs
示例10: Activate
public void Activate()
{
if (!playerCritter) { playerCritter = FindObjectOfType<Player>().GetCritter(); }
mainPanel.SetActive(true);
subPanel.Activate();
gameObject.SetActive(true);
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:8,代码来源:EvoTree.cs
示例11: Activate
public void Activate(Critter critter, Adaptation.BodySlot newType)
{
gameObject.SetActive(true);
InitializeSlots(critter, newType);
PopulatePanel();
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:8,代码来源:SubPanelInfo.cs
示例12: Activate
public void Activate(Critter newCritter)
{
critter = newCritter;
if (critter) {
PopulateLocalCritterList();
}
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:8,代码来源:AdaptationListUI.cs
示例13: GetTokenSpriteOptions
public static Sprite[] GetTokenSpriteOptions(Critter critter)
{
Critter.locomotionType[] locomotions = critter.GetLocomotion();
tokenSpriteOptions = PopulateTokenSpriteOptions(locomotions).ToArray();
return tokenSpriteOptions;
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:8,代码来源:GameController.cs
示例14: Activate
public void Activate(Critter newCritter, Hex newHab, WarningChecker.warningType newType, Sprite newSprite, Color32 color)
{
icon = GetComponentsInChildren<Image>()[1];
type = newType;
icon.sprite = newSprite;
icon.color = color;
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:9,代码来源:WarningIcon.cs
示例15: Start
void Start()
{
critterGen = FindObjectOfType<CritterGenerator>();
myCritter = gameObject.GetComponent<Critter>();
cloneCritter = false;
splitTimer = timerResetVal;
currentTurn = TurnTimer.currentTurn;
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:9,代码来源:EvolutionList.cs
示例16: GetItems
public IList<Item> GetItems(Critter critter)
{
var container = GetContainer (critter, false);
if (container == null)
return new List<Item> (0);
var itemArray = new ItemArray ();
container.GetItems (0, itemArray);
return new List<Item> (itemArray);
}
开发者ID:wladimiiir,项目名称:vault112,代码行数:10,代码来源:ItemHolderData.cs
示例17: Activate
public void Activate(Critter newCritter)
{
critter = newCritter;
size = critter.GetSize();
scale = .4f + (.05f * size);
Vector3 scaleVect = new Vector3(scale, scale, 1);
gameObject.GetComponent<RectTransform>().localScale = scaleVect;
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:10,代码来源:CritterSpriteScaler.cs
示例18: Crossover
/// <summary>
/// Applies crossover to 2 parents to create a child.
/// </summary>
/// <param name="first">
/// The first parent of the crossover.
/// </param>
/// <param name="second">
/// The second parent of the crossover.
/// </param>
/// <returns>
/// If the operation is successful then the result is returned, otherwise null.
/// </returns>
public Critter[] Crossover(Critter first, Critter second)
{
var random = Random.GetInstance();
List<NodeWrapper<INetworkNode>> firstNodes = first.Route;
List<NodeWrapper<INetworkNode>> secondNodes = second.Route;
var crossoverPoints = new List<KeyValuePair<int, int>>();
for (int i = 0; i < firstNodes.Count; i++)
{
for (int j = 0; j < secondNodes.Count; j++)
{
if (firstNodes[i].Node.Equals(secondNodes[j].Node))
{
crossoverPoints.Add(new KeyValuePair<int, int>(i, j));
break;
}
}
}
if (crossoverPoints.Count == 0)
{
// throw new Exception("StandardBreeder.cs: The crossover points are undefined.");
// crossoverPoints.Add(new KeyValuePair<int, int>(random.Next(firstNodes.Count - 1), random.Next(secondNodes.Count - 1)));
return null;
}
var firstChild = new Route(-1);
var secondChild = new Route(-1);
KeyValuePair<int, int> crossoverPoint = crossoverPoints[random.Next(crossoverPoints.Count - 1)];
firstChild.AddRange(firstNodes.GetRange(0, crossoverPoint.Key));
firstChild.AddRange(secondNodes.GetRange(crossoverPoint.Value, secondNodes.Count - crossoverPoint.Value));
secondChild.AddRange(secondNodes.GetRange(0, crossoverPoint.Value));
secondChild.AddRange(firstNodes.GetRange(crossoverPoint.Key, firstNodes.Count - crossoverPoint.Key));
var output = new[]
{
new Critter((Route)firstChild.Clone(), new Fitness()),
new Critter((Route)secondChild.Clone(), new Fitness())
};
output[0].DepartureTime = second.DepartureTime;
output[1].DepartureTime = first.DepartureTime;
Assert.That(output[0].DepartureTime != default(DateTime));
Assert.That(output[1].DepartureTime != default(DateTime));
if (output == null || output[0] == null || output[1] == null)
{
throw new Exception("StandardBreeder.cs: One or more decendants of crossover are null.");
}
return output;
}
开发者ID:NoxHarmonium,项目名称:rmitjourneyplanner,代码行数:67,代码来源:StandardBreeder.cs
示例19: Activate
public void Activate()
{
gameObject.SetActive(true);
if(!critter){
critter = FindObjectOfType<Player>().GetCritter();
}
if(critter){
habList.Populate(critter);
}
}
开发者ID:Paulgherve1,项目名称:Critters,代码行数:11,代码来源:HabPanel.cs
示例20: PutItems
public void PutItems(Critter critter, IList<Item> items)
{
var container = GetContainer (critter, true);
if (container == null)
return;
var itemArray = new ItemArray ();
itemArray.AddRange (items);
Global.MoveItems (itemArray, container, 0);
}
开发者ID:wladimiiir,项目名称:vault112,代码行数:11,代码来源:ItemHolderData.cs
注:本文中的Critter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论