[Survival Game Development Series]
Survival Game Lesson1 - Switch Flashlights with Key Press.
• C# Switch Flashlights with Key Press ...
Survival Game Lesson2 - Polishing lighting.
• C# Switch Lights with Key Press in Un...
Survival Game Lesson3 - Press Key to Pick Up Objects.
• C# Press Key to Pick Up Objects in Un...
Survival Game Lesson4 - Load Scene with Key Press.
• Load Scene with Key Press C# in Unity...
Survival Game Lesson5 - Open Door with Key Press.
• Open Door with Key Press C# in Unity ...
Survival Game Lesson6 - Add Jump Scares.
• Add Jump Scare to Game with C# in Uni...
Survival Game Lesson7 - Animate a Ghost.
• Animate a Ghost in Unity 3D. Survival...
Survival Game Lesson8 - Gun Mechanics.
• Gun Mechanics in Unity 3D. Survival G...
Survival Game Lesson9 - Bullet Mechanics and Fire Bullet.
• Bullet Mechanics and Fire Bullet in U...
Survival Game Lesson10 - Press Key to Exit Room. Fix small bugs.
• Press Key to Exit Room. Fix small bug...
Survival Game Lesson11 - Enemy AI, Follow/Attack/Kill Player, Player Health.
• Enemy AI, Follow/Attack/Kill Player, ...
Survival Game Lesson12 - Enemy Spawn, Enemy Clone, Destroy Spawn Nest.
• Enemy Spawn, Enemy Clone, Destroy Spa...
Survival Game Lesson13 - Boss Enemy AI, Enemy Health, Ramdomize Enemy Animation.
• Boss Enemy AI, Enemy Health, Ramdomiz...
Survival Game Lesson14 - Build the Final Level.
• Build the Final Level. Survival Game ...
Survival Game Lesson15 - Create Menu and Buttons, Add BG Music.
• Create Menu and Buttons in Unity 3D. ...
[Pick Up Object script]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PressKeyPickUpObject : MonoBehaviour
{
public GameObject Instruction;
public GameObject ThisTrigger;
public GameObject ObjectOnGround;
public GameObject ObjectOnHand;
public bool Action = false;
void Start()
{
Instruction.SetActive(false);
ThisTrigger.SetActive(true);
ObjectOnGround.SetActive(true);
ObjectOnHand.SetActive(false);
}
void OnTriggerEnter(Collider collision)
{
if (collision.transform.tag == "Player")
{
Instruction.SetActive(true);
Action = true;
}
}
void OnTriggerExit(Collider collision)
{
Instruction.SetActive(false);
Action = false;
}
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
if (Action == true)
{
Instruction.SetActive(false);
ObjectOnGround.SetActive(false);
ObjectOnHand.SetActive(true);
ThisTrigger.SetActive(false);
Action = false;
}
}
}
}
-----------------
BG Music: Vindsvept, fantasy music
Смотрите видео C# Press Key to Pick Up Objects in Unity 3D. Survival Game Lesson3 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь DIGA Hub 18 Март 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,638 раз и оно понравилось 56 людям.