Graphics Reference
In-Depth Information
6.1 Building the Scripts
For the weapon system, there are just two main scripts:
1. BaseWeaponController.cs
This is the framework for our weapon control system. It offers everything the sys-
tem requires, and it is intended to be overridden for customization.
2. BaseWeaponScript.cs
This script takes care of individual weapon types. If you were to think of the
BaseWeaponController as the arms of the player, the BaseWeaponScript would be
the design of the weapon it is holding.
6.1.1 BaseWeaponController.cs
Here is the BaseWeaponController.cs script in its completed form:
using UnityEngine;
using System.Collections;
public class BaseWeaponController : MonoBehavior
{
public GameObject[] weapons;
public int selectedWeaponSlot;
public int lastSelectedWeaponSlot;
public Vector3 offsetWeaponSpawnPosition;
public Transform forceParent;
private ArrayList weaponSlots;
private ArrayList weaponScripts;
private BaseWeaponScript TEMPWeapon;
private Vector3 TEMPvector3;
private Quaternion TEMProtation;
private GameObject TEMPgameObject;
private Transform myTransform;
private int ownerNum;
public bool useForceVectorDirection;
public Vector3 forceVector;
private Vector3 theDir;
Search WWH ::




Custom Search