private void SubInitializeAboutProperties(string kind){ switch(kind){ case "KIND1": velocity = new Vector3(-200.0f, 0, 0); //sprite = GameObject.Instantiate(spritePrefabs) as SingleSprite_; sprite.transform.parent = transform; //sprite.Initialize("EnemyFish"); col = transform.collider as CapsuleCollider; col.radius = 45.0f; col.height = 220.0f; col.direction = 0; break; case "KIND2": velocity = new Vector3(-100.0f, 0, 0); //sprite = GameObject.Instantiate(spritePrefabs) as SingleSprite_; sprite.transform.parent = transform; //sprite.Initialize("EnemyFish"); col = transform.collider as CapsuleCollider; col.radius = 80.0f; col.height = 200.0f; col.direction = 0; break; } }
// Use this for initialization void Start () { if(monsterCollider == null) { monsterCollider = GetComponent<CapsuleCollider>(); if(monsterCollider ==null) { monsterCollider = new CapsuleCollider(); } } spellInstances = new Spell[spells.Length]; for(int i = 0; i < spellInstances.Length; i++) { if(spells[i] != null) { spellInstances[i] = Instantiate<Spell>(spells[i]); spellInstances[i].Initialize(gameObject); } } monsterHP = monsterMaxHP; startPos = transform.position; isAlive = true; }
public override void Start( ) { m_data = GetComponent<GreenDragonData>(); base.Start(); m_playerTF = player.transform; m_collider = GetComponent<CapsuleCollider>(); }
void Awake() { Rigidbody = GetComponent<Rigidbody>(); CapsuleCollider = GetComponent<CapsuleCollider>(); Creature = GetComponent<Creature>(); TargetPosition = transform.position; }
// Use this for initialization protected override void Start() { base.Start(); playerDetector = GetComponent<CapsuleCollider>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>(); audioSource = GetComponent<AudioSource>(); }
public override void Awake() { base.Awake(); beamtf = tf.FindChild("Beam").transform; ps = tf.FindChild("Particle System").GetComponent<ParticleSystem>(); capsule = gameObject.GetComponent<CapsuleCollider>(); }
void Start () { if (GameManager.componentActivatorOn) { ComponentActivator.Instance.Register (this, new Dictionary<GameEvent, bool> { //{ GameEvent.Land, true }, { GameEvent.ClimbOverEdge, true }, { GameEvent.StopClimbing, true }, { GameEvent.FinishClimbOver, true }, //{ GameEvent.Land, true }, //{ GameEvent.LandedFirstTime, false }, { GameEvent.StartVineClimbing, false }, { GameEvent.StartEdgeClimbing, false }, { GameEvent.StartWallClimbing, false } }); } charState = GetComponent<RomanCharState>(); animator = GetComponent<Animator>(); rb = GetComponent<Rigidbody>(); cam = Camera.main.transform; cController = GetComponent<CharacterController>(); cCollider = GetComponent<CapsuleCollider>(); vineClimbCollider = GetComponent<VineClimbController2>(); tunnelObserver = GameManager.Instance.tunnelObserver; combatController = GetComponent<CombatController> (); }
private void Awake() { _collider = GetComponent<CapsuleCollider>(); Height = _collider.height; Width = _collider.radius; BodyBounds = _collider.bounds; }
public void Awake() { capsule = GetComponent<Collider>() as CapsuleCollider; // Set up a reference to the capsule collider. grounded = true; Cursor.lockState = (lockCursor)?(CursorLockMode.Locked):(CursorLockMode.None); rayHitComparer = new RayHitComparer(); }
private void safeInitCollider() { if (null == _cellCollider) { _cellCollider = (CapsuleCollider)GetComponent<CapsuleCollider>(); } }
void Awake() { capsule = GetComponent<CapsuleCollider>(); grabTriggerCol = GetComponent<BoxCollider>(); anim = GetComponent<Animator> (); _charStatus = GetComponent<CharacterStatus> (); _charAttacking = GetComponent<CharacterAttacking> (); _charAI = GetComponent<CharacterAI> (); if (!IsEnemy) { _playerInput = GetComponent<PlayerInput>(); //_playerInputMobile = GetComponent<PlayerInputMobile>(); } // I use these since when we have low health, we will move a bit slower. // When we get more than 25% health again, we will go back to our // default speeds for these. defaultAirSpeed = airSpeed; m_Loco_0Id = Animator.StringToHash ("Base Layer.Locomotion"); m_Loco_1Id = Animator.StringToHash ("LowHealth.Locomotion"); myRigidbody = GetComponent<Rigidbody> (); if (!grabTriggerCol) Debug.LogWarning("PLEASE ASSIGN YOUR Player's GRAB TRIGGER COLLIDER"); else grabTriggerCol.enabled = false; }
protected override void Start() { base.Start(); curStunTime = stunTime; capCollider = GetComponent<CapsuleCollider>(); averageDistance = (maxAttackDistance + minAttackDistance) / 2; }
void Awake() { skeletonManager = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager; if(skeletonController != null) playerId = skeletonController.playerId; else Debug.LogError( "The public variable 'Skeleton Controller' is not assigned! Using skeleton " + "ID 0 as the pivot source."); if(gameObject.transform.parent != null) { if(gameObject.transform.parent.GetComponentInChildren<RUISKinectAndMecanimCombiner>()) kinectAndMecanimCombinerExists = true; } capsuleCollider = GetComponent<CapsuleCollider>(); if(capsuleCollider == null) Debug.LogError("GameObject " + gameObject.name + " must have a CapsuleCollider!"); defaultColliderHeight = capsuleCollider.height; defaultColliderPosition = transform.localPosition; positionKalman = new KalmanFilter(); positionKalman.initialize(3,3); positionKalman.skipIdenticalMeasurements = true; }
/*----------------------------------------------------------| | UNITY METHODS | |----------------------------------------------------------*/ private void Awake () { charState = GetComponent<RomanCharState>(); animator = GetComponent<Animator>(); rb = GetComponent<Rigidbody>(); cCollider = GetComponent<CapsuleCollider>(); }
void Awake() { rigidbody.freezeRotation = true; rigidbody.useGravity = false; cc = GetComponent<CapsuleCollider>(); //Time.timeScale = 0.25f; }
void Start() { m_EquipShopPanel = GameObject.Find("MainUICanvas/EquipShopPanel").GetComponent<EquipShopPanel>(); m_Collider = GetComponent<CapsuleCollider>(); m_MousePos = new Vector3(); }
// Use this for initialization void Start () { rigid = GetComponent<Rigidbody> (); col = GetComponent<CapsuleCollider> (); col.radius = affectRadius; }
void Awake () { capsuleCollider = GetComponent <CapsuleCollider> (); currentHealth = startingHealth; hitParticles = GetComponentInChildren <ParticleSystem> (); animator = GetComponent<Animator> (); }
void Awake() { rigidbody = this.GetComponent<Rigidbody>(); mCollider = this.GetComponent<CapsuleCollider>(); rigidbody.freezeRotation = true; rigidbody.useGravity = false; }
void Start() { anim = GetComponent<Animator>(); characterController = GetComponent<CharacterController>(); col = GetComponent<CapsuleCollider>(); }
public virtual void Initialize(int i_Health_Max_, float f_FireTimer_Max_, GameObject go_ParentBoxCollider_, BoxCollider col_BaseCollider_ = null, CapsuleCollider col_RadiusCollider_ = null) { i_Health = i_Health_Max_; i_Health_Max = i_Health_Max_; go_GridObject_Parent = go_ParentBoxCollider_; b_IsDead = false; // Material newMat = Resources.Load("DEV_Orange", typeof(Material)) as Material; SetMaterialElements(); SetNewMaterialColor(Colors.Default); f_FireTimer = 0; f_FireTimer_Max = f_FireTimer_Max_; if (col_BaseCollider_ != null) col_BaseCollider = col_BaseCollider_; else { if (gameObject.transform.Find("Col_BaseCollider")) col_BaseCollider = gameObject.transform.Find("Col_BaseCollider").GetComponent<BoxCollider>(); } if(col_RadiusCollider_ != null) col_RadiusCollider = col_RadiusCollider_; else { if (gameObject.transform.Find("Col_Radius")) col_RadiusCollider = gameObject.transform.Find("Col_Radius").GetComponent<CapsuleCollider>(); } EnemyList = new List<GameObject>(); }
void Awake() { anim = GetComponent <Animator> (); enemyAudio = GetComponent <AudioSource> (); hitParticles = GetComponentInChildren <ParticleSystem> (); capsuleCollider = GetComponent <CapsuleCollider> (); }
void Awake() { anim = GetComponent <Animator> (); zombieai = GetComponent<ZombieAI> (); rigid = GetComponent<Rigidbody> (); cap = GetComponent<CapsuleCollider> (); }
// Courtesy of Moodie public static Vector3 ClosestPointOnSurface(CapsuleCollider collider, Vector3 to) { Transform ct = collider.transform; // Transform of the collider float lineLength = collider.height - collider.radius * 2; // The length of the line between the centers Vector3 dir = Vector3.up; Vector3 upperSphere = dir * lineLength * 0.5f + collider.center; // The position of the radius of the upper sphere in local coordinates Vector3 lowerSphere = -dir * lineLength * 0.5f + collider.center; // The position of the radius of the lower sphere in local coordinates Vector3 local = ct.InverseTransformPoint(to); // The position of the controller in local coordinates Vector3 p = Vector3.zero; // Contact point Vector3 pt = Vector3.zero; // The point we need to use to get a direction vector with the controller to calculate contact point if (local.y < lineLength * 0.5f && local.y > -lineLength * 0.5f) // Controller is contacting with cylinder, not spheres pt = dir * local.y + collider.center; else if (local.y > lineLength * 0.5f) // Controller is contacting with the upper sphere pt = upperSphere; else if (local.y < -lineLength * 0.5f) // Controller is contacting with lower sphere pt = lowerSphere; //Calculate contact point in local coordinates and return it in world coordinates p = local - pt; p.Normalize(); p = p * collider.radius + pt; return ct.TransformPoint(p); }
void Awake() { enemyScrpt = this.GetComponent<smallEnemy>(); sensor = new GameObject("sensor"); sensor.transform.SetParent(this.transform); sensor.transform.position = this.transform.position; DetectorChild childScript = sensor.gameObject.AddComponent<DetectorChild>(); childScript.debug_ColCheckOff = debug_ColCheckOff; // TEMP DEBUG ADITION sensor.layer = 2; rB = sensor.AddComponent<Rigidbody>(); rB.useGravity = false; rB.constraints = RigidbodyConstraints.FreezeAll; if(GetComponentInParent<smallEnemy>().movementType == smallEnemy.MovementType.A) { detSphere = sensor.AddComponent<SphereCollider>(); detSphere.radius = sensorDistance; detSphere.isTrigger = true; Physics.IgnoreCollision(detSphere, this.GetComponent<Collider>()); } else if(GetComponentInParent<smallEnemy>().movementType == smallEnemy.MovementType.B || GetComponentInParent<smallEnemy>().movementType == smallEnemy.MovementType.C) { detCap = sensor.AddComponent<CapsuleCollider>(); detCap.radius = sensorDistance; detCap.height = capsuleWidth*2; detCap.direction = 2; Physics.IgnoreCollision(detCap, this.GetComponent<Collider>()); } }
void Awake() { col1 = p1.GetComponent <CapsuleCollider> (); col2 = p2.GetComponent <CapsuleCollider> (); col3 = p3.GetComponent <CapsuleCollider> (); col4 = p4.GetComponent <CapsuleCollider> (); }
// Use for initialization. void Awake() { col = GetComponent<CapsuleCollider>(); //コリジョンコンポーネントを取得 col.enabled = false; //一度無効化する(フレアは演出を挟むため) colliderRadius = col.radius; col.radius = 0f; //コライダーの半径を0にする }
void Awake() { sSm = this.gameObject.transform.localScale; sSm = new Vector3 (sSm.x, sSm.y, sSm.z); refT = this.GetComponent<CapsuleCollider> (); sRcc = refT.radius; }
void Start () { _collider = GetComponent<CapsuleCollider>(); _rigidBody = GetComponent<Rigidbody>(); GetComponent<Rigidbody>().AddForce(transform.forward * speed); StartCoroutine(this.ExplosionCannon(3.0f)); }
void Start () { // initialising reference variables anim = gameObject.GetComponent<Animator>(); col = gameObject.GetComponent<CapsuleCollider>(); if(anim.layerCount ==2) anim.SetLayerWeight(1, 1); }
static public int get_center(IntPtr l) { try { UnityEngine.CapsuleCollider self = (UnityEngine.CapsuleCollider)checkSelf(l); pushValue(l, self.center); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int get_height(IntPtr l) { try { UnityEngine.CapsuleCollider self = (UnityEngine.CapsuleCollider)checkSelf(l); pushValue(l, true); pushValue(l, self.height); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.CapsuleCollider o; o = new UnityEngine.CapsuleCollider(); pushValue(l, o); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static public int constructor(IntPtr l) { LuaDLL.lua_remove(l, 1); UnityEngine.CapsuleCollider o; if (matchType(l, 1)) { o = new UnityEngine.CapsuleCollider(); pushObject(l, o); return(1); } LuaDLL.luaL_error(l, "New object failed."); return(0); }
static public int set_center(IntPtr l) { try { UnityEngine.CapsuleCollider self = (UnityEngine.CapsuleCollider)checkSelf(l); UnityEngine.Vector3 v; checkType(l, 2, out v); self.center = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.CapsuleCollider o; o = new UnityEngine.CapsuleCollider(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int set_height(IntPtr l) { try { UnityEngine.CapsuleCollider self = (UnityEngine.CapsuleCollider)checkSelf(l); float v; checkType(l, 2, out v); self.height = v; return(0); } catch (Exception e) { return(error(l, e)); } }
static public int set_radius(IntPtr l) { try { UnityEngine.CapsuleCollider self = (UnityEngine.CapsuleCollider)checkSelf(l); float v; checkType(l, 2, out v); self.radius = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_radius(IntPtr l) { try { UnityEngine.CapsuleCollider self = (UnityEngine.CapsuleCollider)checkSelf(l); float v; checkType(l, 2, out v); self.radius = v; return(0); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
static void CapsuleCollider_direction(JSVCall vc) { if (vc.bGet) { UnityEngine.CapsuleCollider _this = (UnityEngine.CapsuleCollider)vc.csObj; var result = _this.direction; JSApi.setInt32((int)JSApi.SetType.Rval, (System.Int32)(result)); } else { System.Int32 arg0 = (System.Int32)JSApi.getInt32((int)JSApi.GetType.Arg); UnityEngine.CapsuleCollider _this = (UnityEngine.CapsuleCollider)vc.csObj; _this.direction = arg0; } }
static void CapsuleCollider_height(JSVCall vc) { if (vc.bGet) { UnityEngine.CapsuleCollider _this = (UnityEngine.CapsuleCollider)vc.csObj; var result = _this.height; JSApi.setSingle((int)JSApi.SetType.Rval, (System.Single)(result)); } else { System.Single arg0 = (System.Single)JSApi.getSingle((int)JSApi.GetType.Arg); UnityEngine.CapsuleCollider _this = (UnityEngine.CapsuleCollider)vc.csObj; _this.height = arg0; } }
// fields // properties static void CapsuleCollider_center(JSVCall vc) { if (vc.bGet) { UnityEngine.CapsuleCollider _this = (UnityEngine.CapsuleCollider)vc.csObj; var result = _this.center; JSApi.setVector3S((int)JSApi.SetType.Rval, result); } else { UnityEngine.Vector3 arg0 = (UnityEngine.Vector3)JSApi.getVector3S((int)JSApi.GetType.Arg); UnityEngine.CapsuleCollider _this = (UnityEngine.CapsuleCollider)vc.csObj; _this.center = arg0; } }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.CapsuleCollider capsuleCollider = (UnityEngine.CapsuleCollider)value; writer.WriteProperty("center", capsuleCollider.center); writer.WriteProperty("radius", capsuleCollider.radius); writer.WriteProperty("height", capsuleCollider.height); writer.WriteProperty("direction", capsuleCollider.direction); writer.WriteProperty("enabled", capsuleCollider.enabled); writer.WriteProperty("isTrigger", capsuleCollider.isTrigger); writer.WriteProperty("contactOffset", capsuleCollider.contactOffset); writer.WriteProperty("material", capsuleCollider.material); writer.WriteProperty("sharedMaterial", capsuleCollider.sharedMaterial); writer.WriteProperty("tag", capsuleCollider.tag); writer.WriteProperty("name", capsuleCollider.name); writer.WriteProperty("hideFlags", capsuleCollider.hideFlags); }
static int set_direction(IntPtr L) { UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)ToLua.ToObject(L, 1); int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); try { obj.direction = arg0; } catch (Exception e) { return(LuaDLL.luaL_error(L, obj == null ? "attempt to index direction on a nil value" : e.Message)); } return(0); }
static int set_center(IntPtr L) { UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)ToLua.ToObject(L, 1); UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); try { obj.center = arg0; } catch (Exception e) { return(LuaDLL.luaL_error(L, obj == null ? "attempt to index center on a nil value" : e.Message)); } return(0); }
static int get_center(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; UnityEngine.Vector3 ret = obj.center; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index center on a nil value" : e.Message)); } }
static int get_radius(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; float ret = obj.radius; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index radius on a nil value" : e.Message)); } }
static int set_height(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.height = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index height on a nil value" : e.Message)); } }
static int set_radius(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.radius = arg0; return 0; } catch(Exception e) { return LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value"); } }
static int get_direction(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; int ret = obj.direction; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index direction on a nil value" : e.Message)); } }
static int set_center(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; UnityEngine.Vector3 arg0 = ToLua.ToVector3(L, 2); obj.center = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value")); } }
static int set_direction(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.direction = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index direction on a nil value")); } }
static int _CreateUnityEngine_CapsuleCollider(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.CapsuleCollider obj = new UnityEngine.CapsuleCollider(); ToLua.Push(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.CapsuleCollider.New"); } return(0); }
static int get_height(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; float ret = obj.height; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index height on a nil value")); } }
static int get_height(IntPtr L) { UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)ToLua.ToObject(L, 1); float ret; try { ret = obj.height; } catch (Exception e) { return(LuaDLL.luaL_error(L, obj == null ? "attempt to index height on a nil value" : e.Message)); } LuaDLL.lua_pushnumber(L, ret); return(1); }
static int get_radius(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.CapsuleCollider.radius"); #endif object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; float ret = obj.radius; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index radius on a nil value")); } }
static int get_center(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.CapsuleCollider.center"); #endif object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; UnityEngine.Vector3 ret = obj.center; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index center on a nil value")); } }
static int set_direction(IntPtr L) { #if UNITY_EDITOR ToluaProfiler.AddCallRecord("UnityEngine.CapsuleCollider.direction"); #endif object o = null; try { o = ToLua.ToObject(L, 1); UnityEngine.CapsuleCollider obj = (UnityEngine.CapsuleCollider)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.direction = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index direction on a nil value")); } }
static int _CreateUnityEngine_CapsuleCollider(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.CapsuleCollider obj = new UnityEngine.CapsuleCollider(); ToLua.PushSealed(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.CapsuleCollider.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int get_direction(IntPtr l) { UnityEngine.CapsuleCollider o = (UnityEngine.CapsuleCollider)checkSelf(l); pushValue(l, o.direction); return(1); }