// void Awake() // { // swordCollider = this.GetComponent<CapsuleCollider>(); // swordRigidbody = this.GetComponent<Rigidbody>(); // // if (motionAbsorb == null) // { // motionAbsorb = this.GetComponent<MotionAbsorb>(); // } // } public void Init(SwordControl swordControl) { swordCollider = this.GetComponent<BoxCollider>(); swordRigidbody = this.GetComponent<Rigidbody>(); motionAbsorb = this.GetComponent<MotionAbsorb>(); this.swordControl = swordControl; motionAbsorb.weight = 0.0f; swordState = SwordState.Idle; swordCollider.enabled = false; }
// void Awake() // { // swordCollider = this.GetComponent<CapsuleCollider>(); // swordRigidbody = this.GetComponent<Rigidbody>(); // // if (motionAbsorb == null) // { // motionAbsorb = this.GetComponent<MotionAbsorb>(); // } // } public void Init(SwordControl swordControl) { swordCollider = this.GetComponent <BoxCollider>(); swordRigidbody = this.GetComponent <Rigidbody>(); motionAbsorb = this.GetComponent <MotionAbsorb>(); this.swordControl = swordControl; motionAbsorb.weight = 0.0f; swordState = SwordState.Idle; swordCollider.enabled = false; }
// Start is called before the first frame update void Start() { movePlayer = GetComponent <MovePlayer>(); animator = GetComponentInChildren <Animator>(); dash_power = 7; swordControl = this.transform.GetComponentInChildren <SwordControl>(); _sword_col = swordControl.gameObject.GetComponent <BoxCollider>(); sword_col_vector = _sword_col.size; sword_position = _sword_col.center; photonView = GetComponent <PhotonView>(); for (int i = 0; i < skilldata.Length; i++) { skilldata[i].recast_time = skilldata[i].recast_wait_time; } }
/// <summary> /// EXAMPLE BEHAVIOUR /// Queries the database and names the object based on the result. /// </summary> // Use this for initialization void Start() { // Qurey additional data to get the name string value = ""; if (entry.getAdditionalData() != null && entry.getAdditionalData().TryGetValue("name", out value)) { // Set name this.gameObject.name = value; } if (this.gameObject.name == "sword") { BoxCollider bc = gameObject.AddComponent(typeof(BoxCollider)) as BoxCollider; bc.size = new Vector3(.5f, .5f, .5f); bc.isTrigger = true; Rigidbody rb = gameObject.AddComponent(typeof(Rigidbody)) as Rigidbody; SwordControl sc = gameObject.AddComponent(typeof(SwordControl)) as SwordControl; } }
protected virtual void Awake() { swordControl = GetComponent <SwordControl>(); state = AnimationState.Nothing; }
protected virtual void Awake() { swordControl = GetComponent<SwordControl>(); state = AnimationState.Nothing; }