/// <summary> /// cancel any tween on main MainObject object /// </summary> internal void CancelTween() { if (Mainobject) { Mainobject.CancellTweensAndSequences(); } if (Overlay) { Overlay.CancellTweensAndSequences(); } }
/// <summary> /// return true if main MainObjects of two cells are equal /// </summary> internal bool IsMainObjectEquals(GridCell other) { if (other == null) { return(false); } if (other.Mainobject == null) { return(false); } if (Mainobject == null) { return(false); } return(Mainobject.Equals(other.Mainobject));//Check whether the MainObject properties are equal. }
internal void SetMainObject(MainObjectData mObjectData, float radius, GameMode gMode) { if (mObjectData == null) { return; } if (!Mainobject) { Mainobject = MainObject.Create(this, mObjectData, gMode == GameMode.Play, radius, true); // Debug.Log("set mo : " +Mainobject.ToString() ); if (gMode == GameMode.Play) { if (Mainobject == null && IsTopObjectGridcell) { if (coll2D) { coll2D.enabled = true; // use as target for shooting } } if (Mainobject != null && IsTopObjectGridcell) { if (coll2D) { coll2D.enabled = false; } } } else { if (coll2D) { coll2D.enabled = true; } } } else { Mainobject.SetData(mObjectData); } // Debug.Log("Set main object: " + ToString()); }
/// <summary> /// Side hit from shoot bubble, it worked with destroayble mainobject /// </summary> internal void ShootHit(Action completeCallBack) { if (!Mainobject) { if (completeCallBack != null) { completeCallBack(); } return; } Mainobject.ShootHit(completeCallBack); if (Mainobject && Mainobject.Protection <= 0) { Mainobject = null; } if (Overlay) { Overlay.ShootHit(null); } }
/// <summary> /// Set grid cell main object to null, run CollectDelegate (if set) and completeCallBack /// </summary> /// <param name="completeCallBack"></param> internal void CollectShootAreaObject(Action completeCallBack, bool showPrivateScore, bool addPrivateScore, bool decProtection, int privateScore) { if (!Mainobject) { if (completeCallBack != null) { completeCallBack(); } return; } Mainobject.ShootAreaCollect(completeCallBack, showPrivateScore, addPrivateScore, decProtection, privateScore); Mainobject = null; if (IsTopObjectGridcell) { coll2D.enabled = true; } if (Overlay) { Overlay.ShootAreaCollect(null, showPrivateScore, addPrivateScore, decProtection, privateScore); } Overlay = null; }
internal void CollectFalledDown(Action completeCallBack, bool showPrivateScore, bool addPrivateScore, int privateScore) { if (!Mainobject) { if (completeCallBack != null) { completeCallBack(); } return; } Mainobject.gameObject.layer = 2; // ignore shoot raycasting Mainobject.FallDownCollect(completeCallBack, showPrivateScore, addPrivateScore, privateScore); Mainobject = null; if (IsTopObjectGridcell) { coll2D.enabled = true; } if (Overlay) { Overlay.gameObject.layer = 2; // ignore shoot raycasting Overlay.FallDownCollect(null, showPrivateScore, addPrivateScore, privateScore); } Overlay = null; }