Beispiel #1
0
 private void InitializeNPCComponents()
 {
     gAI         = gameObject.AddComponent <NPCAI>();
     gPerception = gameObject.AddComponent <NPCPerception>();
     gBody       = gameObject.AddComponent <NPCBody>();
     // hide flags
     gAI.hideFlags         = HideFlags.HideInInspector;
     gBody.hideFlags       = HideFlags.HideInInspector;
     gPerception.hideFlags = HideFlags.HideInInspector;
 }
        // Use this for initialization
        void Start()
        {
            g_NPCController = GetComponent <NPCController>();
            g_NPCBody       = g_NPCController.Body;
            g_Animator      = GetComponent <Animator>();


            if (g_Animator == null)
            {
                g_NPCController.Debug("NPCIKController --> An animator controller is needed for IK, disabling component during runtime");
                this.enabled = false;
            }

            // default weight
            IK_WEIGHT = IK_WEIGHT < 0.1f ? 1f : IK_WEIGHT;

            g_RightFootPosition = RIGHT_FOOT.position;
            g_LeftFootPosition  = LEFT_FOOT.position;
        }