void Awake() { if (!enemy) enemy = GetComponent<Enemy> (); Weapon = new Item_Weapon ("", minDmg, maxDmg, range, knockback, hitCooldown); if (!enemyMovement) enemyMovement = GetComponentInChildren<EnemyTargetting> (); }
// Use this for initialization void Start() { if (!GroundCheck2) { GameObject instObj = (GameObject) Instantiate(Player.EnemyGC2, GroundCheck.transform.position + GetComponent<Collider>().bounds.extents.z*transform.forward*0.475f, GroundCheck.transform.rotation); instObj.transform.SetParent (transform); GroundCheck2 = instObj.GetComponent<GroundDetect>(); } trueSpeed = speed; if(transform.FindChild ("StunFX")) { StunFX = transform.FindChild ("StunFX").GetComponent<ParticleSystem>(); } if (!effects && GetComponent<Effects> ()) effects = GetComponent<Effects> (); else if (!effects) effects = (Effects) gameObject.AddComponent<Effects> (); if (!view) view = GetComponentInChildren<EnemyTargetting> (); if (!WalkAnim) WalkAnim = GetComponent<Animation> (); BodyMarker[] rendMarkers = GetComponentsInChildren<BodyMarker> (); foreach (BodyMarker marker in rendMarkers) { if(marker.ColourSample) { defColour = marker.GetComponent<MeshRenderer>().materials[marker.submat].color; } rends.Add(marker.GetComponent<MeshRenderer>()); } if (!HP) HP = GetComponent<Health> (); if (groundCol) { defDFric = groundCol.material.dynamicFriction; defSFric = groundCol.material.staticFriction; } if (!rb) { rb = GetComponent<Rigidbody>(); } }