コード例 #1
0
    /*
     * Addes newTarget to the array.
     *      newTarget is added to the first empty space in the array.
     *      If there are no empty spaces, the oldest entry (targets[0]) is overritten by MoveDown(0)
     *      and newTarget is added at the ent of the array.
     * If newTarget is already within the array, it is moved to the front.
     * Returns true if newTarget was not already within the array and false if it was already in the array.
     */
    public bool AddTarget(Magnetic newTarget, AllomanticIronSteel allomancer)
    {
        int indexOfTarget = GetIndex(newTarget);

        if (indexOfTarget >= 0)     // Target is already in the array

        {
            if (indexOfTarget < Count - 1)   // Target is not already at the end of the array
            // MoveDown over old version of the target, and add the new one at the end.
            {
                MoveDown(indexOfTarget, false);
                targets[Count] = newTarget;
                Count++;
            }
            return(false);
        }
        else     // Target is not already in the array.
        // If Count < Size, just add newTarget at Count and increment Count.
        {
            if (Count < Size)
            {
                targets[Count] = newTarget;
                Count++;
            }
            else        // Count == Size. Move all elements down, delete the first entry, and add newTarget to the end.
                        // Do not increment Count, since the number of entries doesn't change.
            {
                MoveDown(0);
                targets[Count] = newTarget;
                Count++;
            }
            return(true);
        }
    }
コード例 #2
0
    // Use this for initialization
    void Awake()
    {
        playerIronSteel        = GameObject.FindGameObjectWithTag("Player").GetComponent <AllomanticIronSteel>();
        pullTargetsSumForce    = new Text[AllomanticIronSteel.maxNumberOfTargets];
        pushTargetsSumForce    = new Text[AllomanticIronSteel.maxNumberOfTargets];
        pullTargetsActualForce = new Text[AllomanticIronSteel.maxNumberOfTargets];
        pushTargetsActualForce = new Text[AllomanticIronSteel.maxNumberOfTargets];

        highlightedTargetMass      = Instantiate(templateMass, transform, false);
        highlightedTargetMass.text = "";

        for (int i = 0; i < AllomanticIronSteel.maxNumberOfTargets; i++)
        {
            pullTargetsActualForce[i]       = Instantiate(templateActualForce, transform, false);
            pushTargetsActualForce[i]       = Instantiate(templateActualForce, transform, false);
            pullTargetsActualForce[i].text  = "";
            pushTargetsActualForce[i].text  = "";
            pullTargetsActualForce[i].color = HUD.weakBlue;
            pushTargetsActualForce[i].color = HUD.weakBlue;

            pullTargetsSumForce[i]      = pullTargetsActualForce[i].GetComponentsInChildren <Text>()[1];
            pushTargetsSumForce[i]      = pushTargetsActualForce[i].GetComponentsInChildren <Text>()[1];
            pullTargetsSumForce[i].text = "";
            pushTargetsSumForce[i].text = "";
        }
    }
コード例 #3
0
 /*
  * Removes all entries out of range, using the given burn rate
  */
 public void RemoveAllOutOfRange(float burnRate, AllomanticIronSteel allomancer)
 {
     if (MaxRange == 0)
     {
         for (int i = 0; i < Count; i++)
         {
             if (SettingsMenu.settingsData.pushControlStyle == 0 && SettingsMenu.settingsData.controlScheme != SettingsData.Gamepad)
             {
                 if (!targets[i].IsInRange(allomancer, burnRate))
                 {
                     RemoveTargetAt(i);
                 }
             }
             else     // If using the Magnitude control style (or gamepad), burn rate does not affect the range of targets
             {
                 if (!targets[i].IsInRange(allomancer, 1))
                 {
                     RemoveTargetAt(i);
                 }
             }
         }
     }
     else if (MaxRange > 0)
     {
         for (int i = 0; i < Count; i++)
         {
             if ((targets[i].CenterOfMass - allomancer.CenterOfMass).sqrMagnitude > MaxRange * MaxRange)
             {
                 RemoveTargetAt(i);
             }
         }
     } // else: maxrange < 0, no max range
 }
コード例 #4
0
ファイル: Hand.cs プロジェクト: facybenbook/Invested
 // Use this for initialization
 void Awake()
 {
     centerOfMass   = transform.parent;
     Pouch          = GetComponent <CoinPouch>();
     allomancer     = GetComponentInParent <AllomanticIronSteel>();
     distanceToHand = transform.localPosition.magnitude;
 }
コード例 #5
0
 private void Start()
 {
     allomancer       = Player.PlayerIronSteel;
     allomancerPewter = Player.PlayerPewter;
     irons            = transform.Find("Irons").GetComponentsInChildren <Renderer>();
     steels           = transform.Find("Steels").GetComponentsInChildren <Renderer>();
     pewters          = transform.Find("Pewters").GetComponentsInChildren <Renderer>();
 }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        parentIronSteel = GetComponentInParent <AllomanticIronSteel>();
        parentRigidbody = GetComponentInParent <Rigidbody>();

        Count = 50;
        UpdateUI();
    }
コード例 #7
0
ファイル: GameManager.cs プロジェクト: facybenbook/Invested
 public static void RemoveMagnetic(Magnetic magnetic)
 {
     // Remove from all allomancers
     foreach (Allomancer allomancer in Allomancers)
     {
         AllomanticIronSteel ironSteel = allomancer.GetComponent <AllomanticIronSteel>();
         if (ironSteel)
         {
             ironSteel.RemoveTarget(magnetic);
         }
     }
     MagneticsInScene.Remove(magnetic);
 }
コード例 #8
0
ファイル: BurnRateMeter.cs プロジェクト: gkjolin/Invested
    void Awake()
    {
        playerIronSteel = GameObject.FindGameObjectWithTag("Player").GetComponent <AllomanticIronSteel>();
        Text[] texts = GetComponentsInChildren <Text>();
        actualForceText    = texts[0];
        playerInputText    = texts[1];
        sumForceText       = texts[2];
        metalLineCountText = texts[3];

        burnRateImage       = GetComponent <Image>();
        burnRateImage.color = burnRateImage.color;
        Clear();
    }
コード例 #9
0
ファイル: Magnetic.cs プロジェクト: facybenbook/Invested
 // Checks if the Allomancer would be able to sense this Magnetic with ironsight
 public bool IsInRange(AllomanticIronSteel allomancer, float burnRate)
 {
     return(allomancer.CalculateAllomanticForce(this).magnitude *burnRate > SettingsMenu.settingsData.metalDetectionThreshold);
 }