Пример #1
0
 public void SetSources(GameObject player)
 {
     source = player.GetComponent <NetworkFighterScript>();
     health = player.GetComponent <FighterHealthScript>();
 }
Пример #2
0
    public void Initialize()
    {
        if (initialized)
        {
            return;
        }

        keyList = new int[7]
        {
            10,
            11,
            12,
            13,
            14,
            15,
            16
        };

        database = new Dictionary <int, System.Action>
        {
            { 10, TakeDamage },
            { 11, SpeedBoost },
            { 12, HealSelf },
            { 13, Teleport },
            { 14, TakeBigDamage },
            { 15, Arrow },
            { 16, GravityIncrease }
        };

        cardNames = new Dictionary <int, string>
        {
            { 10, "Damage 10" },
            { 11, "Speed Up" },
            { 12, "Heal Up" },
            { 13, "Teleport" },
            { 14, "Damage 25" },
            { 15, "Arrow" },
            { 16, "Gravity Increase" }
        };

        cardTexts = new Dictionary <int, string>
        {
            { 10, "Opponent takes 10 damage." },
            { 11, "Your speed increases slightly." },
            { 12, "You heal for up to 10 damage." },
            { 13, "You can teleport in any direction you point towards." },
            { 14, "Opponent takes 25 damage." },
            { 15, "You shoot an arrow." },
            { 16, "Your opponent's gravity is now higher." }
        };

        manaCosts = new Dictionary <int, string>
        {
            { 10, "1" },
            { 11, "2" },
            { 12, "2" },
            { 13, "2" },
            { 14, "2" },
            { 15, "1" },
            { 16, "1" }
        };

        source = GameObject.Find("Main Character (Network)(Clone)").GetComponent <NetworkFighterScript>();
        health = GameObject.Find("Main Character (Network)(Clone)").GetComponent <FighterHealthScript>();

        initialized = true;
    }
    //public float GravTimer
    //{
    //    get { return gravTimer; }
    //    set { gravTimer = value; }
    //}

    //public float OpponentGravTimer
    //{
    //    get { return opponentGravTimer; }
    //    set { opponentGravTimer = value; }
    //}
    #endregion


    void Start()
    {
        if (playerNumber > 2 || playerNumber < 1)
        {
            playerNumber = 1;
        }

        defaultTime           = Time.timeScale;
        timeStopTimer         = 0.0f;
        opponentTimeStopTimer = 0.0f;

        //baseGravScale = GetComponent<Rigidbody2D>().gravityScale;
        //totalGravTimer = 0;
        //opponentGravTimer = 0;
        //gravTimer = 0;

        ArtArrayNum = 0;

        rigid = GetComponent <Rigidbody2D>();
        anim  = GetComponent <Animator>();
        transform.position      = new Vector3(transform.position.x, transform.position.y, -1);
        localPlayerHealthScript = GetComponent <FighterHealthScript>();

        CmdSetLives(4);

        //set player state to 0, meaning they haven't lost or won
        CmdSetPlayerState(0);

        endGameText = GameObject.Find("EndGameText");
        //endGameText.GetComponent<Text>().text = "Not Ready\nPress spacebar to be ready";

        readied      = false;
        matchStarted = false;

        manaGems    = new Image[5];
        manaGems[0] = GameObject.Find("ManaGem1").GetComponent <Image>();
        manaGems[1] = GameObject.Find("ManaGem2").GetComponent <Image>();
        manaGems[2] = GameObject.Find("ManaGem3").GetComponent <Image>();
        manaGems[3] = GameObject.Find("ManaGem4").GetComponent <Image>();
        manaGems[4] = GameObject.Find("ManaGem5").GetComponent <Image>();

        manaBar = GameObject.Find("ManaPower").GetComponent <Slider>();

        lifePlayer1    = new Image[4];
        lifePlayer1[0] = GameObject.Find("Life1Player1").GetComponent <Image>();
        lifePlayer1[1] = GameObject.Find("Life2Player1").GetComponent <Image>();
        lifePlayer1[2] = GameObject.Find("Life3Player1").GetComponent <Image>();
        lifePlayer1[3] = GameObject.Find("Life4Player1").GetComponent <Image>();

        lifePlayer2    = new Image[4];
        lifePlayer2[0] = GameObject.Find("Life1Player2").GetComponent <Image>();
        lifePlayer2[1] = GameObject.Find("Life2Player2").GetComponent <Image>();
        lifePlayer2[2] = GameObject.Find("Life3Player2").GetComponent <Image>();
        lifePlayer2[3] = GameObject.Find("Life4Player2").GetComponent <Image>();

        telegraph1 = GameObject.Find("TelegraphImage1").GetComponent <Image>();
        telegraph2 = GameObject.Find("TelegraphImage2").GetComponent <Image>();

        telegraph1.enabled = false;
        telegraph2.enabled = false;

        damageTextPlayer1 = GameObject.Find("DamageTextPlayer1").GetComponent <Text>();
        damageTextPlayer2 = GameObject.Find("DamageTextPlayer2").GetComponent <Text>();

        lastDamage = 0;
    }