Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     m_moving  = GetComponent <MovingBehaviour>();
     m_phyChar = GetComponent <PhysicCharBehaviour>();
     m_pathFindingBehaviour = GetComponent <MapPathFindingBehaviour>();
     m_animCtrl             = GetComponent <CharAnimationController>();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     m_fAngOff = 360f * Random.value;
     m_player  = GameObject.FindGameObjectWithTag("Player");
     m_moving  = GetComponent <MovingBehaviour>();
     m_phyChar = GetComponent <PhysicCharBehaviour>();
     m_pathFindingBehaviour = GetComponent <MapPathFindingBehaviour>();
     m_animCtrl             = GetComponent <CharAnimationController>();
 }
Ejemplo n.º 3
0
        public void OnSceneGUI()
        {
            PhysicCharBehaviour myTarget = (PhysicCharBehaviour)target;

            float fHandleSize = 0.04f * HandleUtility.GetHandleSize(myTarget.transform.position);

            Vector3[] verts = new Vector3[]
            {   //NOTE: GUI Y axis has opposite direction, so y sign is changed
                new Vector3(myTarget.CollRect.xMin, myTarget.CollRect.yMin, 0) + myTarget.transform.position,
                new Vector3(myTarget.CollRect.xMax, myTarget.CollRect.yMin, 0) + myTarget.transform.position,
                new Vector3(myTarget.CollRect.xMax, myTarget.CollRect.yMax, 0) + myTarget.transform.position,
                new Vector3(myTarget.CollRect.xMin, myTarget.CollRect.yMax, 0) + myTarget.transform.position,
            };
            Handles.DrawSolidRectangleWithOutline(verts, new Color(0, 0, 0, 0), new Color(0f, 0.4f, 1f));

            Vector3[] handles = new Vector3[verts.Length];
            for (int i = 0; i < verts.Length; ++i)
            {
                handles[i]    = (verts[i] + verts[(i + 1) % verts.Length]) / 2;
                Handles.color = Color.cyan;
                handles[i]    = Handles.FreeMoveHandle(handles[i], Quaternion.identity, fHandleSize, Vector3.zero, Handles.DotCap);
                //handles[i].y = -handles[i].y; // restore y sign
                handles[i] -= myTarget.transform.position;
            }

            myTarget.CollRect.yMin = handles[0].y;
            myTarget.CollRect.xMax = handles[1].x;
            myTarget.CollRect.yMax = handles[2].y;
            myTarget.CollRect.xMin = handles[3].x;

            Vector3 vCenter = new Vector3(myTarget.CollRect.center.x, myTarget.CollRect.center.y);

            vCenter  = Handles.FreeMoveHandle(vCenter + myTarget.transform.position, Quaternion.identity, fHandleSize, Vector3.zero, Handles.DotCap);
            vCenter -= myTarget.transform.position;
            myTarget.CollRect.center = new Vector2(vCenter.x, vCenter.y);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(target);
            }
        }
Ejemplo n.º 4
0
 protected virtual void Start()
 {
     m_animCtrl = GetComponent <CharAnimationController>();
     m_phyChar  = GetComponent <PhysicCharBehaviour>();
 }
 protected override void Start()
 {
     base.Start();
     m_playerCtrl = GameObject.FindObjectOfType <PlayerController>();
     phyChar      = GetComponent <PhysicCharBehaviour>();
 }
 protected virtual void Start()
 {
     m_animCtrl = GetComponent<CharAnimationController>();
     m_phyChar = GetComponent<PhysicCharBehaviour>();
 }