コード例 #1
0
    public void GetDamage(int amount, ShipRoom targetRoom)
    {
        int trueDamage = statsSCR.GetDamage(amount);

        if (trueDamage > 0)
        {
            engineMng.GetDamageOnEngine(targetRoom.engine, trueDamage);
            GameObject[] chars = GameObject.FindGameObjectsWithTag("Character");
            foreach (GameObject myChar in chars)
            {
                if (Vector3.Distance(myChar.transform.position, targetRoom.roomPosition) < 0.45f)
                {
                    myChar.GetComponent <CharacterManager>().GetDamage(trueDamage);
                }
                else
                {
                    foreach (ShipCell cell in targetRoom.cells)
                    {
                        if (Vector3.Distance(myChar.transform.position, cell.position) < 0.45f)
                        {
                            myChar.GetComponent <CharacterManager>().GetDamage(trueDamage);
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
    public void GetDamage(int amount, ShipRoom targetRoom)
    {
        int trueDamage = playerStats.GetTrueDamage(amount);

        if (playerStats.maxHealth2 > 0)
        {
            Engine repairEngine = engineMng.GetEngine(Engine.engineType.repair);
            if (repairEngine.operated)
            {
                if (repairEngine.operatedBy != null)
                {
                    repairEngine.operatedBy.GetComponent <CharacterManager>().GainExp(Engine.engineType.repair);
                }
            }
        }
        if (trueDamage > 0)
        {
            engineMng.GetDamageOnEngine(targetRoom.engine, trueDamage);
            GameObject[] chars = GameObject.FindGameObjectsWithTag("Character");
            foreach (GameObject myChar in chars)
            {
                if (Vector3.Distance(myChar.transform.position, targetRoom.roomPosition) < 0.45f)
                {
                    myChar.GetComponent <CharacterManager>().GetDamage(trueDamage);
                }
                else
                {
                    foreach (ShipCell cell in targetRoom.cells)
                    {
                        if (Vector3.Distance(myChar.transform.position, cell.position) < 0.45f)
                        {
                            myChar.GetComponent <CharacterManager>().GetDamage(trueDamage);
                        }
                    }
                }
            }
        }
    }