Пример #1
0
 private static void DrawSphereGizmo(VisualAspect aspect, GizmoType gizmoType)
 {
     if (aspect.Radius > 0f)
     {
         Gizmos.color = aspect.AspectColor;
         Gizmos.DrawWireSphere(aspect.transform.position, aspect.Radius);
     }
 }
Пример #2
0
    /// <summary>
    /// Start does all the setup work for this action, assigning the "defcommander" aspect and removing
    /// the "defsoldier" aspect.  A Formation Harness is added, set to "Column" as the current formation
    /// </summary>
    /// <param name="ai">The AI executing the action</param>
    public override void Start(AI ai)
    {
        base.Start(ai);

        //Add the commander aspect and remove the soldier aspect.
        EntityRig rig = ai.Body.GetComponentInChildren<EntityRig>();
        if (rig.Entity.GetAspect("defcommander") == null)
        {
            VisualAspect tCommanderAspect = new VisualAspect() { AspectName = "defcommander" };
            rig.Entity.AddAspect(tCommanderAspect);
            VisualAspect tSoldierAspect = rig.Entity.GetAspect("defsoldier") as VisualAspect;
            if (tSoldierAspect != null)
                tCommanderAspect.MountPoint = tSoldierAspect.MountPoint;
            else tCommanderAspect.Position = new Vector3(0f, 1f, 0f);

        }

        //Add the formation harness set to the Column formation
        _formationElement.CurrentHarness = "Column";
        ai.AddCustomElement(_formationElement);
    }
Пример #3
0
        private static void DrawIcon(VisualAspect targ)
        {
            SensorRenderUtil.AspectMaterial.SetColor("_colorSolid", Color.black);
            SensorRenderUtil.AspectMaterial.SetFloat("_colorAlpha", 0.4f);

            Matrix4x4 mat = Matrix4x4.TRS(targ.transform.position, Quaternion.identity, Vector3.one * 0.1f);

            for (int i = 0; i < SensorRenderUtil.AspectMaterial.passCount; ++i)
            {
                SensorRenderUtil.AspectMaterial.SetPass(i);
                Graphics.DrawMeshNow(PrimitiveUtil.GetMesh(PrimitiveType.Sphere), mat);
            }

            SensorRenderUtil.AspectMaterial.SetColor("_colorSolid", targ.AspectColor);
            SensorRenderUtil.AspectMaterial.SetFloat("_colorAlpha", 0.8f);

            mat = Matrix4x4.TRS(targ.transform.position, Quaternion.identity, Vector3.one * 0.08f);

            for (int i = 0; i < SensorRenderUtil.AspectMaterial.passCount; ++i)
            {
                SensorRenderUtil.AspectMaterial.SetPass(i);
                Graphics.DrawMeshNow(PrimitiveUtil.GetMesh(PrimitiveType.Sphere), mat);
            }
        }