예제 #1
0
    public void SubmitDemon()
    {
        foreach(Transform t in places)
        {
            if(t.childCount < 1)
            {
                return;
            }
        }
        foreach (Ingredients ingred in currentIngs)
        {
           if(ingred == null)
              return;
           else
           {
              Destroy(places[partToIndex(ingred.GetPart())].GetChild(0).gameObject);
              GameManager.instance.HeldIngredients[ingred.GetName()]--;
           }
        }
        IngredientUI.UpdateAllNumbers();

        summonedDemon = DemonFactory.Instance.makeDemon(currentIngs[1], currentIngs[2], currentIngs[0]);
        summonedDemon.transform.position = new Vector3(-2.5f, 1);
        //DemonFactory.Instance.makeDemon(currentIngs[1], currentIngs[2], currentIngs[0]);
        backButton.gameObject.SetActive(false);
        submitButton.gameObject.SetActive(false);
        dismissButton.gameObject.SetActive(true);
    }
예제 #2
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.GetComponentInParent <DemonBase>() != null && collision.gameObject.tag != "BodyCollider")
        {
            DemonBase cmpDemon = collision.GetComponentInParent <DemonBase>();

            for (int i = 0; i < m_spikesData.Count; i++)
            {
                //if the demon is already inside the spikes
                if (cmpDemon == m_spikesData[i].AssociatedDemon)
                {
                    //remove the collider from the associated demon's collider list
                    if (m_spikesData[i].Colliders.Contains(collision))
                    {
                        m_spikesData[i].Colliders.Remove(collision);

                        //all the limbs have exited the spikes
                        if (m_spikesData[i].Colliders.Count == 0)
                        {
                            cmpDemon.IsInDanger = false;
                            m_spikesData.RemoveAt(i);
                        }
                        else if (m_spikesData[i].Colliders.Count == 1 && m_spikesData[i].Colliders[0].tag == "BodyCollider")
                        {
                            cmpDemon.IsInDanger = false;
                            m_spikesData.RemoveAt(i);
                        }
                    }
                }
            }
        }
    }
예제 #3
0
 public void assignDemon(DemonBase demon)
 {
     //call when submitting a demon for a contract
     currentUnassignedContract.getContractPerformance (demon);
     demonScreen.SetActive (false);
     if (currentUnassignedContract.repeatable) {
         cashContract (currentUnassignedContract);
     }
     else cacheContract (currentUnassignedContract);
       roundManager.RefreshContractUI();
       // Now that we've checked the demon, we can get rid of it
       Destroy(demon.gameObject);
 }
예제 #4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.GetComponentInParent <DemonBase>() != null)
        {
            DemonBase otherDemon = collision.GetComponentInParent <DemonBase>();

            if (!m_enemiesOnPreassurePlate.Contains(otherDemon))
            {
                m_currentWeight = m_currentWeight + otherDemon.Weight;
                m_enemiesOnPreassurePlate.Add(otherDemon);
            }
        }
    }
예제 #5
0
    // On trigger enter kill the character that collided.
    private void OnTriggerEnter2D(Collider2D collision)
    {
        DemonBase cmpDemon = collision.GetComponentInParent <DemonBase>();

        if (cmpDemon != null)
        {
            bool isCounted = false;

            for (int i = 0; i < m_spikesData.Count; i++)
            {
                //if the demon is already inside the spikes
                if (cmpDemon == m_spikesData[i].AssociatedDemon)
                {
                    isCounted = true;

                    //add the collider to the associated demon's collider list if it isnt already included
                    if (!m_spikesData[i].Colliders.Contains(collision) && collision.gameObject.tag != "BodyCollider")
                    {
                        m_spikesData[i].Colliders.Add(collision);
                    }
                }
            }
            if (!isCounted)
            {
                if (cmpDemon.IsControlledByPlayer)
                {
                    m_spikesData.Add(new SpikesWeightData(cmpDemon, collision));
                    cmpDemon.IsInDanger = true;
                    PosesionManager.Instance.PossessNearestDemon(100, cmpDemon);
                    collision.GetComponentInParent <BloodInstantiate>().InstantiateBlood();
                }
                else
                {
                    if (collision.gameObject.tag != "BodyCollider")
                    {
                        m_spikesData.Add(new SpikesWeightData(cmpDemon, collision));
                        cmpDemon.IsInDanger = true;
                        //Create the method for enemy death
                        print("Create the method for enemy death");
                        //cmpDemon.Die();
                    }
                }
            }
        }
    }
예제 #6
0
 public override float getContractPerformance(DemonBase demon)
 {
     GameManager.instance.GiveIngredients(Mathf.Min(demon.GetTier(), 4), 4);
     this.finalPerf = (-2f*demon.GetTier());
     return this.finalPerf;
 }
예제 #7
0
 //applies a one time use item to a specific demon and removes it from your inventory
 public void giveDemonItem(int itemIndex, DemonBase demon)
 {
     if(storedItems[itemIndex].type == ItemBase.itemType.oneTime) {
         demon.itemInventory.Add (storedItems[itemIndex]);
         demon.applyItemBoosts ();
         storedItems.RemoveAt (itemIndex);
     }
 }
예제 #8
0
 void Update()
 {
     //if(Input.GetKeyDown(KeyCode.Space)) next = true;
     //if(Input.GetKeyDown(KeyCode.Backspace)) prev = true;
     if (next) {
         if (!Input.GetKey ("x"))
             next = false;
         if (last)
             DestroyImmediate (last.gameObject);
         do {
             vals [0]++;
             for (int i = 0; i < 4; i++) {
                 if (vals [i] >= 5) {
                     vals [i] = 0;
                     if (i < 3)
                         vals [i + 1]++;
                 }
             }
         } while((vals [2] != 4) == (vals [0] != 4));
         last = makeDemon (vals [2], ((Ingredients.stats)vals [3]).ToString (), vals [0], ((Ingredients.stats)vals [1]).ToString (), vals [0], ((Ingredients.stats)vals [1]).ToString ());
     } else if (prev) {
         prev = false;
         if (last)
             DestroyImmediate (last.gameObject);
         vals [0]--;
         for (int i = 0; i < 4; i++) {
             if (vals [i] < 0) {
                 vals [i] = 4;
                 if (i < 3)
                     vals [i + 1]--;
             }
         }
         last = makeDemon (vals [2], ((Ingredients.stats)vals [3]).ToString (), vals [0], ((Ingredients.stats)vals [1]).ToString (), vals [0], ((Ingredients.stats)vals [1]).ToString ());
     }
 }
예제 #9
0
 //returns a number between 1 and 0 that represents how well a contract went
 public virtual float getContractPerformance(DemonBase demon)
 {
     float output = 1F;
     for(int i = 0; i < statReqList.Count; i++) {
         float f = statReqList [i];
         if (f > 0.01F) {//avoid div/0 errors
             output *= demon.statList [i] / statReqList [i];
         }
     }
     if (output == 0)
         output = 0.1f;
     finalPerf = output;
     return output;
 }
예제 #10
0
 //returns the time it takes to complete a contract
 public virtual float getContractCompletionTime(DemonBase demon)
 {
     float perf = getContractPerformance (demon);
     float compTime = perfTimeMult / perf;
     return compTime;
 }