Inheritance: MonoBehaviour
Example #1
0
 private async void IncantationChanged(object sender, EventArgs e)
 {
     if (thisIncantation == null && IncantationEntry.Text != "None")
     {
         thisIncantation = new Models.Spell.Incantation
         {
             ID = await ItemsPage.ConnectionSpells.Table <Incantation>().CountAsync(),
             IncantationText = IncantationEntry.Text,
             Value           = IncantationComplexity.SelectedIndex,
             Offensive       = Offensive.IsToggled,
             ForeignLanguage = FL.IsToggled,
             Loud            = Loud.IsToggled
         };
         thisSpell.MyIncantation = thisIncantation.ID;
         await ItemsPage.ConnectionSpells.InsertOrReplaceAsync(thisIncantation);
     }
     else if (IncantationEntry.Text != "None")
     {
         thisIncantation.Offensive       = Offensive.IsToggled;
         thisIncantation.Loud            = Loud.IsToggled;
         thisIncantation.ForeignLanguage = FL.IsToggled;
         thisIncantation.IncantationText = IncantationEntry.Text;
         thisIncantation.Value           = IncantationComplexity.SelectedIndex;
         thisSpell.MyIncantation         = thisIncantation.ID;
         await ItemsPage.ConnectionSpells.InsertOrReplaceAsync(thisIncantation);
     }
     SetValueLabel();
 }
Example #2
0
    void Update()
    {
        Incantation i = Incantation.Instance;

        int myId = Network.isServer ?
                   TerrainGrid.ServerPlayerId : TerrainGrid.ClientPlayerId;

        if (myId == totem.Owner)
        {
            healthFullRenderer.material.color  = i.hpGoodColor;
            healthEmptyRenderer.material.color = i.hpBadColor;
        }
        else
        {
            healthFullRenderer.material.color  = i.hpEnemyGoodColor;
            healthEmptyRenderer.material.color = i.hpEnemyBadColor;
        }

        if (totem.TotemMaxHealth == 0)
        {
            return;
        }

        float scale = pivot.localScale.x;
        float t     = Mathf.Pow(0.01f, Time.deltaTime);

        scale = scale * t +
                (float)totem.TotemCurrentHealth / totem.TotemMaxHealth * (1 - t);
        pivot.localScale = new Vector3(scale, 1, 1);

        transform.localPosition =
            new Vector3(0, 0.28f + 0.865f * totem.AnimalObjects.Count, 0);
    }
Example #3
0
    public void SpawnIncant(Vector2 pos)
    {
        GameObject go =
            Instantiate(incantPrefab, map.cells[(int)pos.x, (int)pos.y].transform.position, incantPrefab.transform.rotation, incantRoot);
        Incantation newIncant = go.GetComponent <Incantation>();

        newIncant.setGridPos(pos);
        incantationList.Add(newIncant);
        newIncant.PlayIncantation();
    }
Example #4
0
    /// <summary>
    /// sub cast
    /// </summary>

    public void initIncantation()
    {
        if (incantation != null)
        {
            Incantation old = incantation;
            incantation = (Incantation)Instantiate(incantationSa, transform.position, transform.rotation);
            Destroy(old.gameObject);
        }
        else
        {
            incantation = (Incantation)Instantiate(incantationSa, transform.position, transform.rotation);
        }
        incantation.initIncantation(this);
        incantation.transform.position = this.transform.position + this.transform.forward * 0.5f;
    }
    /// @arg repeating If true, we are repeating an already-confirmed action (from the other player's client)
    /// @note All local player actions should be executed via this method (hence TryDig() etc. are private)
    public void ProcessAction(Incantation action, bool repeating = false)
    {
        if (localPlayer.turnTaken && !repeating) {
            Basics.Log("Unable to comply; turn not in progress");
            return; // no actions until next turn
        }

        bool result = false;

        result = TryDig (action.tileName); // only action we can carry out at the moment

        Basics.assert(result || !repeating); // we shouldn't be replaying unsuccessful actions
        if (result && !repeating)
            // Successfully took an action, queue for replay
            localPlayer.actionsTaken.Add(action);
    }
Example #6
0
    public void EndIncantation(string[] res)
    {
        int     x;
        int     y;
        int     success;
        Vector2 pos;

        if (res.Length != 4)
        {
            return;
        }
        x       = int.Parse(res[1]);
        y       = int.Parse(res[2]);
        success = int.Parse(res[3]);
        pos     = new Vector2(x, y);
        Incantation incantation = spawnManager.incantationList.Find(incant => incant.getGridPos() == pos);

        if (incantation != null)
        {
            incantation.StopIncantation(success == 1);
            spawnManager.incantationList.Remove(incantation);
            StartCoroutine(DelayDestroy(incantation.gameObject, 2f));
        }
    }
Example #7
0
 void Awake()
 {
     Instance = this;
 }
Example #8
0
 void Awake()
 {
     Instance = this;
 }