本文整理汇总了C#中UnityEngine.Animation.Blend方法的典型用法代码示例。如果您正苦于以下问题:C# Animation.Blend方法的具体用法?C# Animation.Blend怎么用?C# Animation.Blend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Animation
的用法示例。
在下文中一共展示了Animation.Blend方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStart
public override void OnStart(PartModule.StartState state) {
if (state == StartState.Editor) { return; }
part.force_activate();
reprocessor = new NuclearFuelReprocessor(part);
if (part.airlock != null && part.airlock.transform != null) {
if (part.airlock.transform.gameObject != null) {
Destroy(part.airlock.transform.gameObject);
}
}
anim = part.FindModelAnimators(animName).FirstOrDefault();
if (anim != null) {
anim[animName].layer = 1;
if (IsEnabled) {
anim.Blend(animName, 2, 0);
} else {
play_down = false;
anim[animName].speed = -1f;
anim[animName].normalizedTime = 0f;
anim.Blend(animName, 0, 1);
}
}
}
示例2: primaryAnimator
protected void primaryAnimator(float speed, float time, WrapMode wrap, string name, Animation a)
{
if (a != null)
{
a[name].speed = speed;
if (!a.IsPlaying(name))
{
a[name].wrapMode = wrap;
a[name].normalizedTime = time;
a.Blend(name, 1f);
}
}
}
示例3: OnStart
public override void OnStart(PartModule.StartState state)
{
Actions["DeployRadiatorAction"].guiName = Events["DeployRadiator"].guiName = String.Format("Deploy Radiator");
Actions["RetractRadiatorAction"].guiName = Events["RetractRadiator"].guiName = String.Format("Retract Radiator");
Actions["ToggleRadiatorAction"].guiName = String.Format("Toggle Radiator");
if (state == StartState.Editor)
{
//if (hasTechsRequiredToUpgrade())
//{
// isupgraded = true;
// hasrequiredupgrade = true;
// isupgraded = true;
//}
//return;
}
FNRadiator.list_of_radiators.Add(this);
anim = part.FindModelAnimators(animName).FirstOrDefault();
if (anim != null)
{
anim[animName].layer = 1;
if (radiatorIsEnabled)
{
anim.Blend(animName, 1, 0);
}
else
{
//anim.Blend (animName, 0, 0);
}
//anim.Play ();
}
if (isDeployable)
{
pivot = part.FindModelTransform("suntransform");
original_eulers = pivot.transform.localEulerAngles;
}
else
{
radiatorIsEnabled = true;
}
//if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER | HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
//{
// if (PluginHelper.hasTech(upgradeTechReq))
// {
// hasrequiredupgrade = true;
// }
//}
//else
//{
// hasrequiredupgrade = true;
//}
if (radiatorInit == false)
{
radiatorInit = true;
}
//if (!isupgraded)
//{
radiatorType = originalName;
//}
//else
//{
// radiatorType = upgradedName;
// radiatorTemp = upgradedRadiatorTemp;
//}
radiatorTempStr = radiatorTemp + "K";
this.part.force_activate();
}
示例4: blendAnimation
private void blendAnimation(Animation animation, AnimationClip clip)
{
if(!animation.IsPlaying(clip.name)) {
animation.Blend(clip.name, 4f);
}
}
示例5: OnStart
public override void OnStart(PartModule.StartState state) {
if (state == StartState.Editor) { return; }
reprocessor = new NuclearFuelReprocessor(part);
anti_factory = new AntimatterFactory(part);
ConfigNode config = PluginHelper.getPluginSaveFile();
part.force_activate();
anim = part.FindModelAnimators(animName1).FirstOrDefault();
anim2 = part.FindModelAnimators(animName2).FirstOrDefault();
if (anim != null && anim2 != null) {
anim[animName1].layer = 1;
anim2[animName2].layer = 1;
if (IsEnabled) {
//anim [animName1].normalizedTime = 1f;
//anim2 [animName2].normalizedTime = 1f;
//anim [animName1].speed = -1f;
//anim2 [animName2].speed = -1f;
anim.Blend(animName1, 1, 0);
anim2.Blend(animName2, 1, 0);
} else {
//anim [animName1].normalizedTime = 0f;
//anim2 [animName2].normalizedTime = 0f;
//anim [animName1].speed = 1f;
//anim2 [animName2].speed = 1f;
//anim.Blend (animName1, 0, 0);
//anim2.Blend (animName2, 0, 0);
play_down = false;
}
//anim.Play ();
//anim2.Play ();
}
if (IsEnabled && last_active_time != 0) {
float global_rate_multipliers = 1;
crew_capacity_ratio = ((float)part.protoModuleCrew.Count) / ((float)part.CrewCapacity);
global_rate_multipliers = global_rate_multipliers * crew_capacity_ratio;
if (active_mode == 0) { // Science persistence
double now = Planetarium.GetUniversalTime();
double time_diff = now - last_active_time;
float altitude_multiplier = (float)(vessel.altitude / (vessel.mainBody.Radius));
altitude_multiplier = Math.Max(altitude_multiplier, 1);
float stupidity = 0;
foreach (ProtoCrewMember proto_crew_member in part.protoModuleCrew) {
stupidity += proto_crew_member.stupidity;
}
stupidity = 1.5f - stupidity / 2.0f;
double science_to_increment = GameConstants.baseScienceRate * time_diff / 86400 * electrical_power_ratio * stupidity * global_rate_multipliers * PluginHelper.getScienceMultiplier(vessel.mainBody.flightGlobalsIndex, vessel.LandedOrSplashed) / ((float)Math.Sqrt(altitude_multiplier));
science_to_increment = (double.IsNaN(science_to_increment) || double.IsInfinity(science_to_increment)) ? 0 : science_to_increment;
science_to_add += (float)science_to_increment;
} else if (active_mode == 2) { // Antimatter persistence
double now = Planetarium.GetUniversalTime();
double time_diff = now - last_active_time;
List<PartResource> antimatter_resources = part.GetConnectedResources(InterstellarResourcesConfiguration.Instance.Antimatter).ToList();
float currentAntimatter_missing = (float) antimatter_resources.Sum(ar => ar.maxAmount-ar.amount);
float total_electrical_power_provided = (float)(electrical_power_ratio * (GameConstants.baseAMFPowerConsumption + GameConstants.basePowerConsumption) * 1E6);
double antimatter_mass = total_electrical_power_provided / GameConstants.warpspeed / GameConstants.warpspeed * 1E6 / 20000.0;
float antimatter_peristence_to_add = (float)-Math.Min(currentAntimatter_missing, antimatter_mass * time_diff);
part.RequestResource("Antimatter", antimatter_peristence_to_add);
}
}
}
示例6: OnStart
public override void OnStart(PartModule.StartState state)
{
if (state == StartState.Editor)
{
if (this.HasTechsRequiredToUpgrade())
{
isupgraded = true;
upgradePartModule();
}
return;
}
if (isupgraded)
upgradePartModule();
else
{
if (this.HasTechsRequiredToUpgrade())
hasrequiredupgrade = true;
}
// update gui names
Events["BeginResearch"].guiName = beginResearchName;
reprocessor = new NuclearFuelReprocessor(part);
anti_factory = new AntimatterFactory(part);
ConfigNode config = PluginHelper.getPluginSaveFile();
part.force_activate();
anim = part.FindModelAnimators(animName1).FirstOrDefault();
anim2 = part.FindModelAnimators(animName2).FirstOrDefault();
if (anim != null && anim2 != null)
{
anim[animName1].layer = 1;
anim2[animName2].layer = 1;
if (IsEnabled)
{
//anim [animName1].normalizedTime = 1f;
//anim2 [animName2].normalizedTime = 1f;
//anim [animName1].speed = -1f;
//anim2 [animName2].speed = -1f;
anim.Blend(animName1, 1, 0);
anim2.Blend(animName2, 1, 0);
}
else
{
//anim [animName1].normalizedTime = 0f;
//anim2 [animName2].normalizedTime = 0f;
//anim [animName1].speed = 1f;
//anim2 [animName2].speed = 1f;
//anim.Blend (animName1, 0, 0);global_rate_multipliers
//anim2.Blend (animName2, 0, 0);
play_down = false;
}
//anim.Play ();
//anim2.Play ();
}
if (IsEnabled && last_active_time != 0)
{
float global_rate_multipliers = 1;
crew_capacity_ratio = ((float)part.protoModuleCrew.Count) / ((float)part.CrewCapacity);
global_rate_multipliers = global_rate_multipliers * crew_capacity_ratio;
if (active_mode == 0) // Science persistence
{
double time_diff = Planetarium.GetUniversalTime() - last_active_time;
float altitude_multiplier = Math.Max((float)(vessel.altitude / (vessel.mainBody.Radius)), 1);
float kerbalResearchSkillFactor = part.protoModuleCrew.Sum(proto_crew_member => GetKerbalScienceFactor(proto_crew_member) / 2f);
double science_to_increment = kerbalResearchSkillFactor * GameConstants.baseScienceRate * time_diff
/ GameConstants.EARH_DAY_SECONDS * electrical_power_ratio * global_rate_multipliers * PluginHelper.getScienceMultiplier(vessel) //PluginHelper.getScienceMultiplier(vessel.mainBody.flightGlobalsIndex, vessel.LandedOrSplashed)
/ ((float)Math.Sqrt(altitude_multiplier));
science_to_increment = (double.IsNaN(science_to_increment) || double.IsInfinity(science_to_increment)) ? 0 : science_to_increment;
science_to_add += (float)science_to_increment;
}
else if (active_mode == 2) // Antimatter persistence
{
double time_diff = Planetarium.GetUniversalTime() - last_active_time;
List<PartResource> antimatter_resources = part.GetConnectedResources(InterstellarResourcesConfiguration.Instance.Antimatter).ToList();
float currentAntimatter_missing = (float) antimatter_resources.Sum(ar => ar.maxAmount-ar.amount);
float total_electrical_power_provided = (float)(electrical_power_ratio * (PluginHelper.BaseAMFPowerConsumption + PluginHelper.BasePowerConsumption) * 1E6);
double antimatter_mass = total_electrical_power_provided / GameConstants.warpspeed / GameConstants.warpspeed * 1E6 / 20000.0;
float antimatter_peristence_to_add = (float)-Math.Min(currentAntimatter_missing, antimatter_mass * time_diff);
part.RequestResource("Antimatter", antimatter_peristence_to_add);
}
}
}
示例7: PlayAnimation
private bool PlayAnimation(Animation animation, string name)
{
bool b = false;
if(animation != null && name != "" && animation[name] != null)
{
if(this.show) animation[name].layer = this.min;
if(this.playOptions[this.number] == "Play")
{
animation.Play(name, this.playMode);
}
else if(this.playOptions[this.number] == "CrossFade")
{
animation.CrossFade(name, this.time, this.playMode);
}
else if(this.playOptions[this.number] == "Blend")
{
animation.Blend(name, this.speed, this.time);
}
else if(this.playOptions[this.number] == "PlayQueued")
{
animation.PlayQueued(name, this.queueMode, this.playMode);
}
else if(this.playOptions[this.number] == "CrossFadeQueued")
{
animation.CrossFadeQueued(name, this.time, this.queueMode, this.playMode);
}
b = true;
}
return b;
}
示例8: OnStart
public override void OnStart(PartModule.StartState state)
{
Actions["DeployRadiatorAction"].guiName = Events["DeployRadiator"].guiName = String.Format("Deploy Radiator");
Actions["RetractRadiatorAction"].guiName = Events["RetractRadiator"].guiName = String.Format("Retract Radiator");
Actions["ToggleRadiatorAction"].guiName = String.Format("Toggle Radiator");
if (state == StartState.Editor) { return; }
FNRadiator.list_of_radiators.Add (this);
anim = part.FindModelAnimators (animName).FirstOrDefault ();
//orig_emissive_colour = part.renderer.material.GetTexture (emissive_property_name);
if (anim != null) {
anim [animName].layer = 1;
if (radiatorIsEnabled) {
anim.Blend (animName, 1, 0);
} else {
//anim.Blend (animName, 0, 0);
}
//anim.Play ();
}
if (isDeployable) {
pivot = part.FindModelTransform ("suntransform");
original_eulers = pivot.transform.localEulerAngles;
} else {
radiatorIsEnabled = true;
}
if(HighLogic.CurrentGame.Mode == Game.Modes.CAREER) {
if(PluginHelper.hasTech(upgradeTechReq)) {
hasrequiredupgrade = true;
}
}else{
hasrequiredupgrade = true;
}
if (radiatorInit == false) {
radiatorInit = true;
if(hasrequiredupgrade) {
isupgraded = true;
}
}
if (!isupgraded) {
radiatorType = originalName;
} else {
radiatorType = upgradedName;
radiatorTemp = upgradedRadiatorTemp;
}
radiatorTempStr = radiatorTemp + "K";
this.part.force_activate();
}
示例9: lightAnimator
private void lightAnimator(Animation a, string name, bool stop)
{
if (!a.IsPlaying(name) && !stop)
{
a[name].speed = 1f;
a[name].normalizedTime = 0f;
a[name].wrapMode = WrapMode.Loop;
a.Blend(name);
}
else if (stop)
{
a[name].normalizedTime = a[name].normalizedTime % 1;
a[name].wrapMode = WrapMode.Clamp;
}
}
示例10: animator
//Controls the main, door-opening animation
private void animator(float speed, float time, Animation a, string name)
{
if (a != null)
{
a[name].speed = speed;
if (!a.IsPlaying(name))
{
a[name].normalizedTime = time;
a.Blend(name, 1f);
}
}
}