本文整理汇总了C#中Controller2D.Hooked方法的典型用法代码示例。如果您正苦于以下问题:C# Controller2D.Hooked方法的具体用法?C# Controller2D.Hooked怎么用?C# Controller2D.Hooked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller2D
的用法示例。
在下文中一共展示了Controller2D.Hooked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerEnter2D
//On collision stops the hook from moving and tells the player to come to the hook
void OnTriggerEnter2D(Collider2D col){
if(hitPlatform || playerhooked)
return;
if(col.gameObject.tag == "HookGate" & !poweredUp){
renderer.material.color = Color.red;
//Added powerhook component and copy info from respective hook gate
HookGate hookGate = col.gameObject.GetComponent<HookGate>();
PowerHook pH = gameObject.AddComponent<PowerHook>();
pH.spawnInfo = new PowerSpawn(hookGate.spawnInfo);
//just change the type on the fly
pH.spawnInfo.type = PowerType.POWERHOOK;
pH.spawnInfo.owner = networkController.theOwner;
gameObject.tag = "PowerHook";
poweredUp = true;
audio.PlayOneShot(flamehook);
GameObject hookfire = (GameObject)Instantiate(fireeffect, transform.position, transform.rotation);
hookfire.transform.parent = gameObject.transform;
return;
}
if(col.gameObject.tag != "Player" && col.gameObject.tag != "Power" && !col.isTrigger && !returning){
if(!OFFLINE){
if(Analytics.Enabled){
GA.API.Design.NewEvent("Hooked Environment", col.transform.position);
}
}
rigidbody2D.velocity = Vector2.zero;
//If hitting a moving platform, the hook moves with the platform
transform.parent = col.transform;
animator.SetTrigger("Hooked");
shooter.GetComponent<Hook>().HitPlatform();
if (!playSound)
{
AudioSource.PlayClipAtPoint(hookWallHitSfx, transform.position);
playSound = true;
}
}
else if(!poweredUp && col.gameObject.tag == "Player" && col.gameObject != shooter && !returning){
if(Network.isServer){
if(Analytics.Enabled && !metriconce){
GA.API.Design.NewEvent("Hook Hits", col.transform.position);
metriconce = true;
}
hookedPlayer = col.gameObject;
NetworkController affectedPlayerNC = hookedPlayer.GetComponent<NetworkController>();
affectedPlayerC2D = hookedPlayer.GetComponent<Controller2D>();
affectedPlayerC2D.Hooked(networkController.theOwner);
rigidbody2D.velocity = Vector2.zero;
targetPosition = transform.position;
shooter.GetComponent<Hook>().HitPlayerLocal(affectedPlayerNC.theOwner);
playerhooked = true;
AudioSource.PlayClipAtPoint( hookHitSfx , transform.position );
animator.SetTrigger("Hooked");
}
}
}