internal static void SimpleInitShip(ShipAI shipAI)
    {
        AQAccess.Register(shipAI);
        if (shipAI == null)
        {
            Debug.Log("ShipAi function parameter is null -> Aborting.");
            return;
        }
        ShipAPI   sapi = shipAI.GetComponentInChildren <ShipAPI>();
        TurretAPI tapi = sapi.TurretControl;

        if (shipAI.ActualShipRoot == null)
        {
            Debug.Log("Missing ship root. np.");
        }
        if (sapi == null)
        {
            Debug.Log("Missing ship API. np.");
        }
        if (sapi == null)
        {
            Debug.Log("Missing turret API. np.");
        }

        AQAccess.Ins.SetData(shipAI, "Source", shipAI);
        AQAccess.Ins.SetData(shipAI, "Root", shipAI.ActualShipRoot);
        AQAccess.Ins.SetData(shipAI, "TurretControl", tapi);
    }
    public override AQResult Execute()
    {
        TurretAPI api = AQAccess.GetData("TurretControl") as TurretAPI;

        if (child == null || child.Execute() == AQResult.Success)
        {
            Debug.Log("AQFIRe");
            api.Fire(fireType);
            return(AQResult.Success);
        }
        return(AQResult.Fail);
    }
Esempio n. 3
0
    public override AQResult Execute()
    {
        Transform target = AQAccess.GetData("Target") as Transform;
        ShipAI    source = AQAccess.GetData("Source") as ShipAI;
        Transform root   = AQAccess.GetData("Root") as Transform;

        source.DrawGizmoSphere(root.position, range);
        if (target != null)
        {
            return(Vector2.Distance(target.position, root.position) < range
                ? AQResult.Success
                : AQResult.Fail);
        }
        return(AQResult.Fail);
    }
Esempio n. 4
0
 private void OnDestroy()
 {
     ActiveSource = null;
     instance     = null;
 }
Esempio n. 5
0
 private void Awake()
 {
     instance = this;
 }