Завершено

Enemy projectiles shoot hit playership object and destory it(?) need someone with Microsoft Visual Studio #c inclined

Hi, I created a Unity game but I like to get the enemy projectiles to shoot and destroy player ship object. Finally, I want the health bar to increase when player ship objects shoots and hits or any enemy ship object or decrease when the enemy ship hits the player ship object.

[login to view URL]

using [login to view URL];

using [login to view URL];

using UnityEngine;

public class Projectiles : MonoBehaviour

{

public Transform playerShip;

public float range = 20.0f;

public float enemyGunImpulse = 10.0f;

bool onRange = false;

public Rigidbody projectile;

Rigidbody2D rigidbody2d;

void Start()

{

float rand = [login to view URL](1.0f, 2.0f);

InvokeRepeating("Shoot", 2, rand);

}

void Shoot()

{

if (onRange)

{

Rigidbody enemyGun = (Rigidbody)Instantiate(projectile, [login to view URL] + [login to view URL], [login to view URL]);

[login to view URL]([login to view URL] * enemyGunImpulse, [login to view URL]);

}

[login to view URL](GetInstanceID() + ": Shoot() called.");

[login to view URL]("Shoot Player!");

}

void Update()

{

onRange = [login to view URL]([login to view URL], [login to view URL]) < range;

if (onRange)

[login to view URL](playerShip);

}

}

[login to view URL]

using UnityEngine;

using [login to view URL];

using [login to view URL];

using System;

public class PlayerHealth : MonoBehaviour

{

[SerializeField] GameObject deathFX;

[SerializeField] Transform parent;

public Image Bar;

public Text Text;

public float max_health = 100f;

public float cur_health = 0f;

//Use this for initialization

void Start()

{

// Initialize the health that is given

cur_health = max_health;

InvokeRepeating("decreaseHealth", 0f, 2f);

}

void OnCollisionEnter(Collision collision)

{

if ([login to view URL]<Projectiles>())

{

max_health -= cur_health;

//if the collision object has a homing script, minus player health by damageToPlayer

}

}

void decreaseHealth()

{

//Subtract the health at the following rate

//Check if the health is 0 before we do any damage

if (cur_health < 0)

{

cur_health = 0;

}

//make a new variable and divide the current health my the maximum health

//this is because the fill value goes from 0 to 1

float calc_health = cur_health / max_health; // 70 / 100 = 0.7

SetHealth(calc_health);

//Change the color of the health bar

Квалификация: .NET, Программирование на С, Программирование на C#, Программирование на C++, Unity 3D

Показать больше object oriented design visual studio, courses need microsoft action pack, create activex object visual studio 2005, company need microsoft excel automation, need microsoft word expert, business firm need accountant visual foxpro programmer, need microsoft certified professional, need help visual basic 2008 project, need artist visual novel, visual studio 2005 need visual basic, need visual studio mentor, need visual studio expert, need microsoft access, need start dance studio, need character visual novel, want design website visual studio need layout, need microsoft project, need teacher visual studio, need a visual studio 2012 professional developer

О работодателе:
( 1 отзыв ) New York, United States

ID проекта: #19779511

Поручен:

sunderplugs11

Hello! My name is Adam, I'm from WV, USA where I've been working in Unity full time for the last 3 years, with a good bit of time as a tutor. I can certainly help you rewrite your Projectile script and give you some Больше

$15 USD за 1 день
(12 отзывов(-а))
4.3

5 фрилансеров(-а) в среднем готовы выполнить эту работу за $17

alexsun1222

Dear,Sir! I am senior C/C++/C# and Unity developer with 6 + years experience. I have rich experience on this field and have done many social apps. I am very confident in this project due to my experience and skills i Больше

$20 USD за 1 день
(7 отзывов(-а))
5.2
abilalc1

Hello, I am a Full Stack Game Designer & Developer, I understand your requirements, and I can do the task in a reasonable amount of time. As you can see from my profile, I have done various projects, and all deliver Больше

$20 USD за 7 дней(-я)
(13 отзывов(-а))
4.0
mariogavotto

Hi my name is Mario. im a game developer. I work with Unity and C#. I can help you to fix and implement your script in the game, Im ready to work now then talk to me in private to discuss more about your game Go Больше

$20 USD за 1 день
(3 отзывов(-а))
2.8
mrla11

I have a great passion for computer programming, I have been working as a programmer for the past 15 years, I worked on small and large scale projects for well known brands. I am currently focused on building mobile ap Больше

$10 USD за 2 дней(-я)
(1 отзыв)
1.8