コード例 #1
0
ファイル: ActionPhase.cs プロジェクト: pauzii/IGD2021
    WeaponDefinitions.WeaponType GetRandomWeapon()
    {
        Array values = Enum.GetValues(typeof(WeaponDefinitions.WeaponType));

        System.Random random = new System.Random();
        WeaponDefinitions.WeaponType randomWeapon = (WeaponDefinitions.WeaponType)values.GetValue(random.Next(values.Length));
        print($"got random weapon: {randomWeapon}");
        return(randomWeapon);
    }
コード例 #2
0
ファイル: ActionPhase.cs プロジェクト: pauzii/IGD2021
    public void ChangeLeftHandWeapon(PhaseHandler.RowPosition rowPosition, WeaponDefinitions.WeaponType weaponType)
    {
        // print("equipping new left hand weapon");
        Transform leftHandTransform = player.transform.parent.Find("Minifig Character/jointScaleOffset_grp/Joint_grp/detachSpine/spine01/spine02/spine03/spine04/spine05/spine06/shoulder_L/armUp_L/arm_L/wristTwist_L/wrist_L/hand_L/finger01_L").transform;
        // weapon color should stay the same as previous
        Color color = leftHandWeapon != null?leftHandWeapon.GetComponent <Renderer>().material.color : Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);

        RemoveLeftHandWeapon();
        // spawns a new weapon and sets it as leftHandWeapon
        leftHandWeapon = SpawnNewWeapon(rowPosition, weaponType, color);
        leftHandWeapon.transform.parent = leftHandTransform;
    }
コード例 #3
0
ファイル: DecisionPhase.cs プロジェクト: pauzii/IGD2021
    public void ChangeEquippedWeapon(WeaponDefinitions.WeaponType weapon, ActionPhase actionPhase)
    {
        // print("ChangeEquippedWeapon triggered");
        if (phase == PhaseHandler.Phase.Decision && !player.IsAiPlayer)
        {
            selectedWeapon = weapon;
            print($"Changing Weapon to {selectedWeapon}");
            // just spawn a dummy weapon, such that it serves as feedback but does not reveal the actual selection
            actionPhase.ChangeLeftHandWeapon("Weapons/SA_Item_Fish");
        }

        else
        {
            print("Changing Weapon is currently not allowed");
            playerMinifigController.PlaySpecialAnimation(MinifigControllerGroupW.SpecialAnimation.IdleImpatient);
        }
    }
コード例 #4
0
ファイル: ActionPhase.cs プロジェクト: pauzii/IGD2021
    GameObject SpawnNewWeapon(PhaseHandler.RowPosition rowPosition, WeaponDefinitions.WeaponType weaponType, Color color)
    {
        // load a gameobject with the correct prefab
        Weapon[] matchingWeapons = WeaponDefinitions.GetWeapon(weaponType, rowPosition);

        if (matchingWeapons.Length > 0)
        {
            string     assetPath = matchingWeapons[0].asset;
            GameObject newWeapon = LoadNewWeapon(assetPath, new Vector3(0.3f, 0.3f, 0.3f), color);
            return(newWeapon);
        }
        else
        {
            // no matching weapon type was found
            throw new InvalidOperationException();
        }
    }
コード例 #5
0
ファイル: ActionPhase.cs プロジェクト: pauzii/IGD2021
    // returns a damage multipler based on the equipped weapon type and the target weapon type strength/weakness
    float GetMultiplier(WeaponDefinitions.WeaponType equippedWeaponType, WeaponDefinitions.WeaponType targetWeaponType)
    {
        WeaponType equippedWeaponTypeInfo = Array.FindAll <WeaponType>(weaponTypes.weaponTypes, weaponType => weaponType.type == equippedWeaponType.ToString())[0];

        if (targetWeaponType.ToString() == equippedWeaponTypeInfo.strength)
        {
            effective = true;
            return(2f);
        }

        else if (targetWeaponType.ToString() == equippedWeaponTypeInfo.weakness)
        {
            ineffective = true;
            return(0.5f);
        }

        else
        {
            return(1f);
        }
    }