public void Init(TurnBasedUnit parentShip)
 {
     trans = transform;
     shieldMat = renderer.material;
     originalColour = shieldMat.GetColor("_Color");
     ParentShip = parentShip;
 }
Beispiel #2
0
    private void Awake()
    {
        unit = GetComponent <TurnBasedUnit>();
        unit.RegisterBehaviour(this);

        animator       = GetComponent <Animator>();
        spriteRenderer = GetComponentInChildren <SpriteRenderer>();
    }
    //private LineRenderer line;
    //int length;
    public override void Init(TurnBasedUnit parentShip)
    {
        base.Init(parentShip);

        //line = GetComponentInChildren<LineRenderer>();
        //#if FULL_DEBUG
        //if (!line)
        //{
        //    Debug.LogError("No line renderer found");
        //}
        //#endif

        //line.enabled = false;
        //laserImpactEffect.Stop();
    }
 public override void Init(TurnBasedUnit _parentShip)
 {
     base.Init(_parentShip);
 }
    /// <summary>
    /// Shows a line to indicate line of fire and shows the target ship's targeting panel for the player to select a component to target
    /// </summary>
    /// <param name="targetUnit"></param>
    /// <param name="show"></param>
    private void TargetShip(TurnBasedUnit targetUnit, bool show)
    {
        if(!targetShip)
        {
            return;
        }
        if (!show)
        {
            DisplayTargetingLine(Vector3.zero, false); //hide line
            targetUnit.ShowTargetingPanel(false,null); //hide panel
            //unsubscribe to component callbacks
            foreach (ShipComponent component in targetUnit.Components)
            {
                component.OnComponentClicked -= OnComponentClick;
                component.OnComponentMouseOver -= OnComponentMouseOver;

            }
        }
        else
        {
            targetUnit.ShowTargetingPanel(true, trans);
            foreach (ShipComponent component in targetUnit.Components)
            {
                component.OnComponentClicked += OnComponentClick;
                component.OnComponentMouseOver += OnComponentMouseOver;
                component.OnComponentPointerExit += OnComponentPointerExit;
            }
        }
    }
Beispiel #6
0
 public void RemoveUnit(TurnBasedUnit unit)
 {
     removedUnits.Add(unit);
 }
Beispiel #7
0
 public void AddUnit(TurnBasedUnit unit)
 {
     units.Add(unit);
 }