예제 #1
0
    /*---------------------------------------------------------------------------------------------------------------------
    -- FUNCTION: Start
    --
    -- DATE: March 9, 2016
    --
    -- REVISIONS: None
    --
    -- DESIGNER: Hank Lo, Allen Tsang
    --
    -- PROGRAMMER: Hank Lo, Allen Tsang
    --
    -- INTERFACE: void Start(void)
    --
    -- RETURNS: void
    --
    -- NOTES:
    -- Function that's called when the script is first executed - it initializes all required values
    ---------------------------------------------------------------------------------------------------------------------*/
    new void Start()
    {
        cooldowns = new float[2] { 0.75f, 15 };

        healthBar = transform.GetChild(0).gameObject.GetComponent<HealthBar>();
        _classStat = new PlayerBaseStat(playerID, healthBar);
        _classStat.MaxHp = 950;
        _classStat.MoveSpeed = 5;
        _classStat.AtkPower = 20;
        _classStat.Defense = 20;

        base.Start();

        fireball = (Rigidbody2D)Resources.Load("Prefabs/Fireball", typeof(Rigidbody2D));
        magicCircle = (Rigidbody2D)Resources.Load("Prefabs/MagicCircle", typeof(Rigidbody2D));

        var controller = Resources.Load("Controllers/magegirl") as RuntimeAnimatorController;
        gameObject.GetComponent<Animator>().runtimeAnimatorController = controller;

        //Player specific initialization
        if (playerID == GameData.MyPlayer.PlayerID)
        {
            //Starting item kit
            Inventory.instance.AddItem(17);
        }

        //add wizard attack sound clip
        au_simple_attack = Resources.Load("Music/Weapons/magegirl_staff_primary") as AudioClip;
        au_special_attack = Resources.Load("Music/Weapons/magegirl_staff_secondary") as AudioClip;
    }
예제 #2
0
    /*---------------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: Start
    *  --
    *  -- DATE: March 9, 2016
    *  --
    *  -- REVISIONS: None
    *  --
    *  -- DESIGNER: Hank Lo, Allen Tsang
    *  --
    *  -- PROGRAMMER: Hank Lo, Allen Tsang
    *  --
    *  -- INTERFACE: void Start(void)
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- Function that's called when the script is first executed - it initializes all required values
    *  ---------------------------------------------------------------------------------------------------------------------*/
    new void Start()
    {
        cooldowns = new float[2] {
            0.75f, 15
        };

        healthBar            = transform.GetChild(0).gameObject.GetComponent <HealthBar>();
        _classStat           = new PlayerBaseStat(playerID, healthBar);
        _classStat.MaxHp     = 950;
        _classStat.MoveSpeed = 5;
        _classStat.AtkPower  = 20;
        _classStat.Defense   = 20;

        base.Start();

        fireball    = (Rigidbody2D)Resources.Load("Prefabs/Fireball", typeof(Rigidbody2D));
        magicCircle = (Rigidbody2D)Resources.Load("Prefabs/MagicCircle", typeof(Rigidbody2D));

        var controller = Resources.Load("Controllers/magegirl") as RuntimeAnimatorController;

        gameObject.GetComponent <Animator>().runtimeAnimatorController = controller;

        //Player specific initialization
        if (playerID == GameData.MyPlayer.PlayerID)
        {
            //Starting item kit
            Inventory.instance.AddItem(17);
        }

        //add wizard attack sound clip
        au_simple_attack  = Resources.Load("Music/Weapons/magegirl_staff_primary") as AudioClip;
        au_special_attack = Resources.Load("Music/Weapons/magegirl_staff_secondary") as AudioClip;
    }
예제 #3
0
    private static void InitalizeStatsPacket(int from, Packet _packet, Player player, PlayerCharacter playerCharacter)
    {
        ShipBaseStat shipStats = new ShipBaseStat();

        shipStats.attack              = player.attack;
        shipStats.health              = player.health;
        shipStats.defence             = player.defence;
        shipStats.rotation            = player.rotation;
        shipStats.speed               = player.speed;
        shipStats.visibility          = player.visibility;
        shipStats.cannon_reload_speed = player.cannon_reload_speed;
        shipStats.crit_chance         = player.crit_chance;
        shipStats.cannon_force        = player.cannon_force;
        shipStats.max_health          = player.maxHealth;

        PlayerBaseStat playerStats = new PlayerBaseStat();

        playerStats.attack      = playerCharacter.attack;
        playerStats.health      = playerCharacter.health;
        playerStats.defence     = playerCharacter.defence;
        playerStats.speed       = playerCharacter.speed;
        playerStats.crit_chance = playerCharacter.crit_chance;
        playerStats.energy      = playerCharacter.energy;
        playerStats.max_health  = playerCharacter.max_health;
        playerStats.maxEnergy   = playerCharacter.max_energy;

        _packet.Write(from);
        _packet.Write(shipStats);
        _packet.Write(playerStats);
    }
예제 #4
0
    /*---------------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: Start
    *  --
    *  -- DATE: March 9, 2016
    *  --
    *  -- REVISIONS: None
    *  --
    *  -- DESIGNER: Hank Lo, Allen Tsang
    *  --
    *  -- PROGRAMMER: Hank Lo, Allen Tsang
    *  --
    *  -- INTERFACE: void Start(void)
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- Function that's called when the script is first executed - it initializes all required values
    *  ---------------------------------------------------------------------------------------------------------------------*/
    new void Start()
    {
        cooldowns = new float[2] {
            0.25f, 8f
        };

        healthBar            = transform.GetChild(0).gameObject.GetComponent <HealthBar>();
        _classStat           = new PlayerBaseStat(playerID, healthBar);
        _classStat.MaxHp     = 1100;
        _classStat.MoveSpeed = 6;
        _classStat.AtkPower  = 100;
        _classStat.Defense   = 25;

        base.Start();

        inSpecial = false;
        fired     = false;

        bullet = (Rigidbody2D)Resources.Load("Prefabs/SmallBullet", typeof(Rigidbody2D));
        laser  = (Rigidbody2D)Resources.Load("Prefabs/Laser", typeof(Rigidbody2D));

        var controller = Resources.Load("Controllers/gunboi") as RuntimeAnimatorController;

        gameObject.GetComponent <Animator>().runtimeAnimatorController = controller;
        mainCamera   = GameObject.Find("Main Camera").GetComponent <Camera>();
        zoomIn       = mainCamera.orthographicSize;
        visionCamera = GameObject.Find("Camera FOV").GetComponent <Camera>();
        hiddenCamera = GameObject.Find("Camera Enemies").GetComponent <Camera>();
        NetworkingManager.Subscribe(fireFromServer, DataType.SpecialCase, (int)SpecialCase.GunnerSpecial);

        //Player specific initialization
        if (playerID == GameData.MyPlayer.PlayerID)
        {
            //Starting item kit
            Inventory.instance.AddItem(12);

            // No longer needed - reference is given to this class when DynamicLight objects are created
            // Initialize Vision Cone and movement components
            //FOVCone       = transform.GetChild(1).gameObject.GetComponent<DynamicLight>();
            //FOVConeHidden     = transform.GetChild(3).gameObject.GetComponent<DynamicLight>();
            movement = gameObject.GetComponent <Movement>();

            startingOrthographicSize = mainCamera.orthographicSize;
            startingConeRadius       = FOVCone.LightRadius;
            startingRangeAngle       = FOVCone.RangeAngle;
        }

        //add gunboi attack sound
        au_simple_attack  = Resources.Load("Music/Weapons/gunboi_gun_primary") as AudioClip;
        au_special_attack = Resources.Load("Music/Weapons/gunboi_gun_secondary") as AudioClip;
        au_gunner_charge  = Resources.Load("Music/Weapons/gunboi_gun_charge") as AudioClip;
    }
예제 #5
0
	new void Start()
	{
		cooldowns = new float[2] { 0.2f, 10f };

        healthBar = transform.GetChild(0).gameObject.GetComponent<HealthBar>();
        _classStat = new PlayerBaseStat(playerID, healthBar);
        _classStat.MaxHp = 1100;
		_classStat.MoveSpeed = 6;
		_classStat.AtkPower = 100;
		_classStat.Defense = 25;

        base.Start();

        inSpecial = false;
		fired = false;
		
		bullet = (Rigidbody2D)Resources.Load("Prefabs/SmallBullet", typeof(Rigidbody2D));
		laser = (Rigidbody2D)Resources.Load("Prefabs/Laser", typeof(Rigidbody2D));
		
		var controller = Resources.Load("Controllers/gunboi") as RuntimeAnimatorController;
		gameObject.GetComponent<Animator>().runtimeAnimatorController = controller;
		mainCamera = GameObject.Find("Main Camera").GetComponent<Camera>();
		zoomIn = mainCamera.orthographicSize;
		visionCamera = GameObject.Find("Camera FOV").GetComponent<Camera>();
		hiddenCamera = GameObject.Find("Camera Enemies").GetComponent<Camera>();
		NetworkingManager.Subscribe(fireFromServer, DataType.SpecialCase, (int)SpecialCase.GunnerSpecial);

        //Player specific initialization
        if (playerID == GameData.MyPlayer.PlayerID)
		{
            //Starting item kit
            Inventory.instance.AddItem(12);

			// Initialize Vision Cone and movement components
			FOVCone 		= transform.GetChild(1).gameObject.GetComponent<DynamicLight>();
			FOVConeHidden 	= transform.GetChild(3).gameObject.GetComponent<DynamicLight>();
			movement 		= gameObject.GetComponent<Movement>();

			startingOrthographicSize = mainCamera.orthographicSize;
			startingConeRadius 		 = FOVCone.LightRadius;
			startingRangeAngle 		 = FOVCone.RangeAngle;
		}

        //add gunboi attack sound
        au_simple_attack = Resources.Load("Music/Weapons/gunboi_gun_primary") as AudioClip;
        au_special_attack = Resources.Load("Music/Weapons/gunboi_gun_secondary") as AudioClip;
        au_gunner_charge = Resources.Load("Music/Weapons/gunboi_gun_charge") as AudioClip;
    }
예제 #6
0
    /*---------------------------------------------------------------------------------------------------------------------
    *  -- FUNCTION: Start
    *  --
    *  -- DATE: March 9, 2016
    *  --
    *  -- REVISIONS:
    *  --          April 4, 2016 - Hank Lo: Balance changes, numbers fixed.
    *  --          April 5, 2016 - Hank Lo: Balance changes, numbers fixed more.
    *  --
    *  -- DESIGNER: Hank Lo, Allen Tsang
    *  --
    *  -- PROGRAMMER: Hank Lo, Allen Tsang
    *  --
    *  -- INTERFACE: void Start(void)
    *  --
    *  -- RETURNS: void
    *  --
    *  -- NOTES:
    *  -- Function that's called when the script is first executed - it initializes all required values
    *  ---------------------------------------------------------------------------------------------------------------------*/
    new void Start()
    {
        cooldowns = new float[2] {
            0.75f, 4
        };

        healthBar            = transform.GetChild(0).gameObject.GetComponent <HealthBar>();
        _classStat           = new PlayerBaseStat(playerID, healthBar);
        _classStat.MaxHp     = 1200;
        _classStat.MoveSpeed = 7;
        Debug.Log("[DEBUG2] Setting Ninja Speed: " + _classStat.MoveSpeed);
        _classStat.AtkPower = 80;
        _classStat.Defense  = 60;

        base.Start();

        sword    = (Rigidbody2D)Resources.Load("Prefabs/NinjaSword", typeof(Rigidbody2D));
        teleport = (GameObject)Resources.Load("Prefabs/NinjaTeleport", typeof(GameObject));

        attack = (Rigidbody2D)Instantiate(sword, transform.position, transform.rotation);
        attack.GetComponent <BoxCollider2D>().enabled = false;

        attackMelee             = attack.GetComponent <Melee>();
        attackMelee.playerID    = playerID;
        attackMelee.teamID      = team;
        attackMelee.damage      = ClassStat.AtkPower;
        attack.transform.parent = transform;

        var controller = Resources.Load("Controllers/ninjaboi") as RuntimeAnimatorController;

        gameObject.GetComponent <Animator>().runtimeAnimatorController = controller;

        //Player specific initialization
        if (playerID == GameData.MyPlayer.PlayerID)
        {
            //Starting item kit
            Inventory.instance.AddItem(1);
        }

        //ninja attack sound
        au_simple_attack  = Resources.Load("Music/Weapons/ninjaboi_sword_primary") as AudioClip;
        au_special_attack = Resources.Load("Music/Weapons/ninjaboi_teleport") as AudioClip;

        Debug.Log("[DEBUG] Setting Ninja Speed After Calling Base: " + _classStat.MoveSpeed);
    }
예제 #7
0
    /*---------------------------------------------------------------------------------------------------------------------
    -- FUNCTION: Start
    --
    -- DATE: March 9, 2016
    --
    -- REVISIONS: 
    --          April 4, 2016 - Hank Lo: Balance changes, numbers fixed.
    --          April 5, 2016 - Hank Lo: Balance changes, numbers fixed more.
    --
    -- DESIGNER: Hank Lo, Allen Tsang
    --
    -- PROGRAMMER: Hank Lo, Allen Tsang
    --
    -- INTERFACE: void Start(void)
    --
    -- RETURNS: void
    --
    -- NOTES:
    -- Function that's called when the script is first executed - it initializes all required values
    ---------------------------------------------------------------------------------------------------------------------*/
    new void Start()
    {
        cooldowns = new float[2] { 0.75f, 4 };

        healthBar = transform.GetChild(0).gameObject.GetComponent<HealthBar>();
        _classStat = new PlayerBaseStat(playerID, healthBar);
        _classStat.MaxHp = 1200;
		_classStat.MoveSpeed = 7;
		Debug.Log ("[DEBUG2] Setting Ninja Speed: " + _classStat.MoveSpeed);
        _classStat.AtkPower = 80;
        _classStat.Defense = 60;

        base.Start();

        sword = (Rigidbody2D)Resources.Load("Prefabs/NinjaSword", typeof(Rigidbody2D));
        teleport = (GameObject)Resources.Load("Prefabs/NinjaTeleport", typeof(GameObject));

        attack = (Rigidbody2D)Instantiate(sword, transform.position, transform.rotation);
        attack.GetComponent<BoxCollider2D>().enabled = false;

        attackMelee = attack.GetComponent<Melee>();
        attackMelee.playerID = playerID;
        attackMelee.teamID = team;
        attackMelee.damage = ClassStat.AtkPower;
        attack.transform.parent = transform;

        var controller = Resources.Load("Controllers/ninjaboi") as RuntimeAnimatorController;
        gameObject.GetComponent<Animator>().runtimeAnimatorController = controller;

        //Player specific initialization
        if (playerID == GameData.MyPlayer.PlayerID)
        {
            //Starting item kit
            Inventory.instance.AddItem(1);
        }

        //ninja attack sound
        au_simple_attack = Resources.Load("Music/Weapons/ninjaboi_sword_primary") as AudioClip;
        au_special_attack = Resources.Load("Music/Weapons/ninjaboi_teleport") as AudioClip;

		Debug.Log ("[DEBUG] Setting Ninja Speed After Calling Base: " + _classStat.MoveSpeed);
    }
예제 #8
0
    public static void Stats(int from, int to)
    {
        using (Packet _packet = new Packet((int)ServerPackets.stats))
        {
            Player          player          = GameServer.clients[from].player;
            PlayerCharacter playerCharacter = player.playerInstance.GetComponent <PlayerCharacter>();

            ShipBaseStat shipStats = new ShipBaseStat();
            shipStats.attack              = player.attack;
            shipStats.health              = player.health;
            shipStats.defence             = player.defence;
            shipStats.rotation            = player.rotation;
            shipStats.speed               = player.speed;
            shipStats.visibility          = player.visibility;
            shipStats.cannon_reload_speed = player.cannon_reload_speed;
            shipStats.crit_chance         = player.crit_chance;
            shipStats.cannon_force        = player.cannon_force;
            shipStats.max_health          = player.maxHealth;

            PlayerBaseStat playerStats = new PlayerBaseStat();
            playerStats.attack      = playerCharacter.attack;
            playerStats.health      = playerCharacter.health;
            playerStats.defence     = playerCharacter.defence;
            playerStats.speed       = playerCharacter.speed;
            playerStats.crit_chance = playerCharacter.crit_chance;
            playerStats.energy      = playerCharacter.energy;
            playerStats.max_health  = playerCharacter.max_health;
            playerStats.maxEnergy   = playerCharacter.max_energy;

            _packet.Write(from);
            _packet.Write(shipStats);
            _packet.Write(playerStats);

            SendTCPData(to, _packet);
        }
    }