예제 #1
0
 public void Possess(IPossessable obj)
 {
     if (obj != null)
     {
         // unpossess the current object
         if (controlledObject != null)
         {
             controlledObject.UnPossess();
         }
         // possess the new object
         controlledObject = obj;
         controlledObject.Possess();
     }
 }
예제 #2
0
    private void PossessPossessable(IPossessable newPossession)
    {
        switch (newPossession.GetPossessableType())
        {
        case EPossessableType.PRIMARY:
            if (primaryPossession != null)
            {
                primaryPossession.UnPossess();
            }
            newPossession.Possess();
            primaryPossession          = newPossession;
            primaryPossessionTransform = primaryPossession.GetGameObject().transform;
            break;

        case EPossessableType.SECONDARY:
            newPossession.Possess();
            secondaryPossessions.Add(newPossession);
            break;

        default:
            break;
        }
    }