public IEnumerator SpawnEnemy()
    {
        Vector2Int yRange = GridExtensions.GetPlayerChessyRange();

        yRange.x = Mathf.Max(0, yRange.x - spawnDistance);
        yRange.y = Mathf.Min(GridManager.instance.size.y - 1, yRange.y + spawnDistance);

        int cntNum = AIManager.instance.AIs.Count;

        foreach (CAICompoment t in AIManager.instance.AIs)
        {
            //if (t.actor.elementComponent.state == ElementState.Frozen)
            //    cntNum--;
        }
        int maxEnemyNum = maxEnemyOverNum + 1;
        int spawnnum    = Mathf.Min(num, maxEnemyNum - cntNum);

        for (int i = 0; i < spawnnum; i++)
        {
            Vector2Int targetLocation = GetValidLocation(yRange);
            GridManager.instance.InstansiateChessAt(ChooseRandomEnemy(), targetLocation);
            AudioSource.PlayClipAtPoint(enemySpawnAudio, GridManager.instance.GetChessPosition3D(targetLocation));
            GameObject t = UIManager.instance.CreateFloorHUD(targetLocation, Color.yellow);
            UIManager.instance.eRefreshFloorHUD.Invoke();
            yield return(1f);

            Destroy(t);
        }
        yield return(0.5f);
    }
    IEnumerator PreEnvironmentTurn()
    {
        if (stormAudio && stormNum > 0)
        {
            GetComponent <AudioSource>().PlayOneShot(stormAudio, stormAudioAmplitude);
        }
        Vector2Int yRange = GridExtensions.GetPlayerChessyRange();

        yRange.x = Mathf.Max(0, yRange.x - stormAroundDistance);
        yRange.y = Mathf.Min(GridManager.instance.size.y - 1, yRange.y + stormAroundDistance);
        for (int i = 0; i < stormNum; i++)
        {
            Vector2Int location;
            do
            {
                location = GridExtensions.GetRandomLocation(yRange);
            }while (stormLocation.Contains(location));
            stormLocation.Add(location);
        }
        foreach (var location in stormLocation)
        {
            GameObject t     = GridExtensions.CreateParticleAt(prefabStorm, location);
            Material   mat   = t.GetComponent <MeshRenderer>().material;
            Color      color = mat.GetColor("_Color");
            mat.SetColor("_Color", Color.yellow);
            stormParticle.Add(t);
            yield return(new WaitForSeconds(1f));

            mat.SetColor("_Color", color);
        }
    }
Esempio n. 3
0
 protected static ListCommand GetListCommand(int page, int pageSize, string orderBy)
 {
     return(new ListCommand
     {
         StartPage = page,
         PageSize = pageSize,
         SortExpression = GridExtensions.ToSqlSortExpression(orderBy ?? "")
     });
 }
Esempio n. 4
0
 protected override bool SetCondition(GActor pa)
 {
     if (!GridExtensions.InRange(GetRange(), pa.location))
     {
         Debug.Log("OutRange");
         return(false);
     }
     return(true);
 }
    Vector2Int GetValidLocation(Vector2Int yRange)
    {
        Vector2Int t = new Vector2Int();

        do
        {
            t = GridExtensions.GetRandomLocation(yRange);
        } while (!GridManager.instance.CheckTransitability(t));
        return(t);
    }
 Vector2Int GetValidLocation(int round, int id)
 {
     if (spawnModifier?.enable == true &&
         spawnModifier.roundSpawnDatas[round][id].speceficLocation &&
         id < spawnModifier.roundSpawnDatas[round].Count)
     {
         return(spawnModifier.roundSpawnDatas[round][id].spawnLocation);
     }
     else
     {
         Vector2Int t = new Vector2Int();
         do
         {
             t = GridExtensions.GetRandomLocation(new Vector2Int(0, 0), GridManager.instance.size);
         } while (!GridManager.instance.CheckTransitability(t));
         return(t);
     }
 }
Esempio n. 7
0
        protected void lbAction_Command(Object sender, CommandEventArgs e)
        {
            var linkButton    = (sender as LinkButton);
            var bodyRowIndex  = Int32.Parse(linkButton.CommandArgument);
            var actionType    = GridExtensions.Parse(linkButton.CommandName);
            var dataCellsList = CellsList.Body.GetDataCellsList(bodyRowIndex) as DataCellsList;

            if (actionType == ActionTypes.Edit)
            {
                HandleEditCommand(linkButton, bodyRowIndex);
            }
            else if (actionType == ActionTypes.Delete)
            {
                var args = new RowDeletedEventArgs(bodyRowIndex, dataCellsList);

                CellsList.Body.GridControl.OnRowDeleted(args);
            }
            else if (actionType == ActionTypes.Custom)
            {
                var args = new ActionCellCustomCommandEventArgs(bodyRowIndex, this);

                CellsList.Body.GridControl.OnActionCellCustomCommand(args);
            }
        }